Regular Expressions 101

Community Patterns

selects all but first and last

1

Regular Expression
PCRE (PHP <7.3)

/
\B[^\s]+[a-z](?![\W]|$)
/
ig

Description

selects all but the firs tand last charcter (excluding punctuation) of words in a string of words

Submitted by anonymous - 8 years ago