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
/
[\x{0621}-\x{0651}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06C0}\x{06CC}]+
/
ugm
Match a single character present in the list below
[\x{0621}-\x{0651}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06C0}\x{06CC}]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\x{0621}-\x{0651} matches a single character in the range between ء (index 1569) and ّ (index 1617) (case sensitive)
\x{067E} matches the character پ with index 67E16 (166210 or 31768) literally (case sensitive)
\x{0686} matches the character چ with index 68616 (167010 or 32068) literally (case sensitive)
\x{0698} matches the character ژ with index 69816 (168810 or 32308) literally (case sensitive)
\x{06A9} matches the character ک with index 6A916 (170510 or 32518) literally (case sensitive)
\x{06AF} matches the character گ with index 6AF16 (171110 or 32578) literally (case sensitive)
\x{06C0} matches the character ۀ with index 6C016 (172810 or 33008) literally (case sensitive)
\x{06CC} matches the character ی with index 6CC16 (174010 or 33148) literally (case sensitive)
Global pattern flags
u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters
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)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
ugm

Test String