Regular Expressions 101

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
(?<=\b)[,.'-:"]+(?=\s|$)|"
/
g
1st Alternative
(?<=\b)[,.'-:"]+(?=\s|$)
Positive Lookbehind
(?<=\b)
Assert that the Regex below matches
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
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 list ,. (case sensitive)
'-: matches a single character in the range between ' (index 39) and : (index 58) (case sensitive)
" matches the character " with index 3410 (2216 or 428) literally (case sensitive)
Positive Lookahead
(?=\s|$)
Assert that the Regex below matches
1st Alternative
\s
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
2nd Alternative
$
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
2nd Alternative
"
" matches the character " with index 3410 (2216 or 428) literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
g

Test String