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)\w
"
Non-capturing group
(?:^|\s)
1st Alternative
^
^ asserts position at start of the string
2nd Alternative
\s
\s matches any whitespace character (equivalent to [\r\n\t\f\v  ])
\w matches any word character (equivalent to [a-zA-Z0-9_])
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"

Test String