паттерн | описание |
---|---|
. | Один любой символ |
\d | Любая цифра |
\D | Любой символ кроме цифры |
\s | Любой пробельный символ |
\S | Любой непробельный символ |
\w | Любая буква, любая цифра и _ |
\W | Не буква, не цифра и не _ |
[...] | Любой из символов в скобках |
[^...] | Любой символ не из скобок |
\b | Начало или конец слова |
\B | Не граница слова |
^ | Начало строки |
$ | Конец строки |
паттерн | описание |
---|---|
{n} |
Повторение ровно n раз |
{n, m} |
От n до m повторений |
{n,} | Хотя бы n повторений |
{,m} |
Не больше m повторений |
? |
Не больше одного повторения - {0,1} |
* |
Любое количество повторений - {0,} |
+ |
Хотя бы одно повторение - {1,} |
паттерн | описание |
---|---|
text | точное совпадение: "text" |
\d{3} | три любые цифры подряд |
\b[A-z]{4}\b | слово из четырёх букв |
[-+]?\d+ | целое число: "7", "+2", "-1", "42", "-100" |
\".*\"
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
\".*?\"
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted
two words: "here" and "there" are quoted