Last active
December 16, 2015 00:49
-
-
Save alanyoshida/5350594 to your computer and use it in GitHub Desktop.
Expressoes Regulares
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Expressoes Regulares | |
^ - Começo de linha | |
$ - Fim da linha | |
[abc] -letras 'a' ou 'b' ou 'c' | |
[a-d] -lista de 'a' a 'd' | |
[a-z] -lista de 'a' a 'z' | |
[a-zA-Z] -lista de letras minusculas e maiusculas | |
[^a-d] -lista negada, ou seja, qualquer coisa diferente de 'a' ou 'b' ou 'c' ou 'd' | |
| -Ou ex: (esse|aquele) | |
a{2} -'a' duas vezes, ou seja, 'aa' | |
a{2,4} -'a' duas a quatro vezes | |
a{2,} -'a' no minimo 2 vezes | |
? -zero ou uma vez ex: a? | |
* -zero ou mais vezes | |
+ -uma ou mais vezes | |
. -qualquer caractere | |
.* -qualquer caractere zero ou mais vezes | |
Diferenças no shell | |
Shell ER | |
* .* | |
? . | |
{a,b} (a|b) | |
[abc] [abc] | |
[^abc] [^abc] | |
[0-9] [0-9] | |
*.txt .*\.txt | |
arquivo-??.txt arquivo-..\.txt | |
arquivo.{txt|html} arquivo\.(txt|html) | |
[Aa]rquivo.txt [Aa]rquivo\.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment