Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(\b[^,\v\s]+?,\s[^,\v\s]+?)((?:\s(?:and|or)\s)(\s?(?:above|across|after|at|around|before|behind|below|beside|between|by|down|during|for|from|in|inside|onto|of|off|on|out|through|to|under|up|with|other)\s)?(?:\w+)(?:[ \]\)\?\.\;\!\:]))
/
gm

Description

Searches prose for lists lacking the serial/Oxford comma.

Submitted by anonymous - 5 years ago