Meta character Description \ Marks the next character as either a special character or a literal. For example, n matches the character n, whereas \n matches a newline character. The sequence \\ matches \ and \( matches (. ^ Matches the beginning of input. $ Matches the end of input. * Matches the preceding character zero or more times. For example, zo* matches either z or zoo. + Matches the preceding character one or more times. For example, zo+ matches zoo but not z. ? Matches the preceding character zero or one time. For example, a?ve? matches the ve in never. . Matches any single character except a newline character. \d Matches a digit character. \s Matches any white space including spaces, tabs, form-feed characters, and so on. x|y Matches either x or y. For example, z|wood matches z or wood. (z|w)oo matches zoo or wood. [xyz] A character set. Matches any one of the enclosed characters. For example, [abc] matches the a in plain. [a-z] A range of characters. Matches any character in the specified range. For example, [a-z] matches any lowercase alphabetic character (pattern) Matches a pattern and remembers the match. To match parentheses characters ( ), use \( or \) {n} n is a non-negative integer. Matches exactly n times. For example, o{2} does not match the o in Bob, but matches the first two os in foooood. {n,m} The m and n variables are non-negative integers. Matches the preceding character at least n and at most m times. For example, o{1,3} matches the first three os in fooooood. The o{0,1} expression is equivalent to o?. -------------------------------------------------------------------------------------- EXEMPLOS: CPF: por exemplo: 987654321-67 ^\d{9}\-\d{2}$ telefone fixo ou movel com ddd como em: (19)91234 5678 ou: (19)3521 5854 e tambem sem o espaco ^\(\d\d\)\d{4,5}\s?\d{4}$ EMAIL: ^[a-z]+\.?[a-z]+@[a-z]+\.[a-z]+\[a-z]{2,3}$ Explicacao para o EMAIL: cadeia de letras minusculas com pelo menos 1 caracter seguida opcionalmente de um "." seguida de cadeia com uma ou mais letras minusculas seguida do caracter "@" seguida de cadeia com uma ou mais letras seguida de "." seguida de cadeia com uma ou mais letras mins. seguida de "." seguida de cadeia com 2 ou 3 letras minúsculas. Casa com: celio.guimaraes@ic.unicamp.br mas não com celio@unicamp.br EXERCICIO: modifique (e simplifique) a expressao regular acima para casar com os 2 emails citados. Dica: use (pattern) Testador online neste site: https://www.regextester.com/