Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
[А-Яа-яё]+\s[А-Яа-яё]+\s[А-Яа-яё]+(вич|вна)
/
gmi
Match a single character present in the list below
[А-Яа-яё]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
А-Я matches a single character in the range between А (index 1040) and Я (index 1071) (case insensitive)
а-я matches a single character in the range between а (index 1072) and я (index 1103) (case insensitive)
ё matches the character ё with index 110510 (45116 or 21218) literally (case insensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff])
Match a single character present in the list below
[А-Яа-яё]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
А-Я matches a single character in the range between А (index 1040) and Я (index 1071) (case insensitive)
а-я matches a single character in the range between а (index 1072) and я (index 1103) (case insensitive)
ё matches the character ё with index 110510 (45116 or 21218) literally (case insensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff])
Match a single character present in the list below
[А-Яа-яё]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
А-Я matches a single character in the range between А (index 1040) and Я (index 1071) (case insensitive)
а-я matches a single character in the range between а (index 1072) and я (index 1103) (case insensitive)
ё matches the character ё with index 110510 (45116 or 21218) literally (case insensitive)
1st Capturing Group
(вич|вна)
1st Alternative
вич
вич
matches the characters вич literally (case insensitive)
2nd Alternative
вна
вна
matches the characters вна literally (case insensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Your regular expression does not match the subject string.

Regular Expression
No Match

/
/
gmi

Test String