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
/
^[a-zA-ZçÇığĞİöÖşŞüÜ]+(?:\s[a-zA-ZçÇığĞİöÖşŞüÜ]+)+$
/
^ asserts position at start of the string
Match a single character present in the list below
[a-zA-ZçÇığĞİöÖşŞüÜ]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
a-z matches a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
çÇığĞİöÖşŞüÜ
matches a single character in the list ç‡Ä±Ÿž°¶–żœ (case sensitive)
Non-capturing group
(?:\s[a-zA-ZçÇığĞİöÖşŞüÜ]+)+
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\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
[a-zA-ZçÇığĞİöÖşŞüÜ]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
a-z matches a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
çÇığĞİöÖşŞüÜ
matches a single character in the list ç‡Ä±Ÿž°¶–żœ (case sensitive)
$ asserts position at the end of the string
Your regular expression does not match the subject string.

Regular Expression
No Match

/
/

Test String