Regular Expressions 101

Community Patterns

1...34567...902

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
(?!<(script|code)[^>]*?>)((\s)(\?|\!|\;|\:))(?![^<]*?<\/(script|code)>)
/
gi

Description

white space before punctuations, outside script and code tags

Submitted by ced - 10 years ago