Regular Expressions 101

Community Patterns

Matches all words + hyphenated-words, words with full-stops, ignoring commas.

0

Regular Expression
PCRE (PHP <7.3)

/
([^\W_]+[^\s,]*)
/
gm

Description

This will match all words.

Including: Hyphenated words. Words ending in periods/full-stops. Number sequences.

It will ignore: commas.

Submitted by anonymous - 6 years ago