Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^ +|( )(?=\1)| +$
/
g

Description

'test' - no match 'test test' - no match ' test' - match (space at the start) 'test ' - match (space at the end) 'test test' - match (single space in the middle)

Submitted by J. Harry B. - 9 years ago