Community Patterns

Community Library Entry

2

Regular Expression
Created·2014-06-14 06:03
Flavor·ECMAScript (JavaScript)

/
^\s*(.*?)\s*$
/
gm
Open regex in editor

Description

Trim leading/trailing space on a string: do not use /gm flags.

Trim each line of a multiline string: use the /gm flag.

Submitted by https://github.com/naomik