Galera preciso fazer uma expressão regular para saber se o que está escrito é CNPJ ou CPF como posso fazer isso ?
A string contém : {CNPJ(1)} ou {CPF(1)}
Obrigado
SirSmart
Olá,
Dessa forma você consegue capturar se é CNPJ ou CPF:
string input = "{CPF(1)}"; Regex rgx = new Regex(@"\{(.*)\(1\)\}"); var result = rgx.Match(input).Groups[1].Captures[0].Value;
Se a resposta for relevante ou tenha resolvido seu problema, marque como útil/resposta! André Secco Microsoft MSP & MSDN Tech Advisor Blog: http://andresecco.com.br GitHub: http://github.com/andreluizsecco Twitter: @andre_secco