Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^\s+|\s+$|\s+(?=\s)
/
gm

Description

Get rid of initial, trailing spaces, and extra middle spaces (more than one space in the middle of a string)

Submitted by anonymous - 6 years ago