2
I would like to use in a code in C# the method Contains
, but instead of spending one string
literal, ie a specific word, pass a pattern or a regular expression as parameter. For example:
Instead of going through:
bool nomeDaVariavel.Contains("#NUSAPRO");
go through something like:
String verifica = @"^#/[A-Z]{1,7}";
//Padrão que captura qualquer String
//que comece com o "#",
//seguido de um a sete caracteres de A a Z em caixa grande
bool nomeDaVariavel.Contains(verifica);
Sure the syntax is wrong, but it’s just to get an idea of what I intend.
If you could help, I’d be grateful.
Your intention is to rewrite the String.Contains() method for the entire application, or just have a call from a specific method to avoid using the Regex API directly?
– Diego Jeronymo