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
"
(?<=[\u4e00-\u9fa5]), *(?=[\u4e00-\u9fa5])
"
gm
Positive Lookbehind
(?<=[\u4e00-\u9fa5])
Assert that the Regex below matches
Match a single character present in the list below
[\u4e00-\u9fa5]
\u4e00-\u9fa5 matches a single character in the range between (index 19968) and (index 40869) (case sensitive)
, matches the character , with index 4410 (2C16 or 548) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
Positive Lookahead
(?=[\u4e00-\u9fa5])
Assert that the Regex below matches
Match a single character present in the list below
[\u4e00-\u9fa5]
\u4e00-\u9fa5 matches a single character in the range between (index 19968) and (index 40869) (case sensitive)
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)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"
gm

Test String

Substitution

Processing...