Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(^\s+)|(\s+$)
/
g

Description

**Removes leading and trailing spaces from the text **Example (do not consider quotes): " Lorem ipsum dolor sit " returns "Lorem ipsum dolor sit"

Submitted by anonymous - 8 years ago