Regular Expressions 101

Community Patterns

1...45678...902

Community Library Entry

8

Regular Expression
PCRE (PHP <7.3)

/
((?:(?(?=(e.g.|z.b.|Figs?\.|\d+\.\d))\2|[^.!?])+[.!?]))
/
gi

Description

Grabs sentences including terms like: e.g. z.b. Figs.These get caught in 1st capturing group.

Problem: how to only accept matching sentences which contain pattern \b\d+[a-z]{0,2}\b?

Submitted by light0 - 11 years ago