Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

Description

string = string.replace(/ +/g," "); for just spaces OR

string = string.replace(/(\s)+/g,"$1"); for turning multiple returns into a single return also.

Submitted by anonymous - 6 years ago