Expressões Regulares x o Operador Like (Visual Basic)
Este tópico compara e contrasta a Visual Basic Like operador e expressões regulares na .NET Framework.
Comparison of Syntax
The following table compares the pattern-specification language syntax for the Like operator with the syntax for regular expressions.
Like operator syntax |
Regular expression syntax |
---|---|
The behavior of the Like operator depends on the Opção Comparar Declarações. The default string comparison method for each source file is Option Compare Binary. |
Regular expressions work the same regardless of Option Compare. |
To match any single character in charlist, use [charlist]. |
To match any single character in charlist, use [charlist]. |
To match any single character not in charlist, use [!charlist]. |
To match any single character not in charlist, use [^charlist]. |
To match any single digit (0–9), use #. |
To match any single digit (0–9), use the character class for decimal digits, \d. |
To match any single character, use ?. |
To match any single character, specify mutually exclusive character classes for the charlist in [charlist]. For example, [\s\S]. |
To match zero or more characters, use *. |
To match zero or more characters, specify mutually exclusive character classes for the charlist in [charlist]*. For example, [\s\S]*. |
Para coincidir com um caractere especial char, coloque-o entre colchetes: [char]. |
Para coincidir com um caractere especial char, preceda-o com uma barra invertida: \char. |
Para corresponder a qualquer caractere em um intervalo, use um hífen (–) para separar os limites inferior e superior do intervalo em um charlist. |
Para corresponder a qualquer caractere em um intervalo, use um hífen (–) para separar os limites inferior e superior do intervalo em um charlist. |
Consulte também
Referência
Conceitos
Expressões Regulares do .NET Framework