Regular Expressions 101

Community Patterns

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 - 9 years ago