Regular Expressions 101

Community Patterns

Remove script tags from code

2

Regular Expression
PCRE (PHP <7.3)

/
(<script.*>|<\/script>)
/
ig

Description

Regular expression to remove only the <script> tags from the code. The regular expression only removes the tags, not the JS code inside the tag.

Submitted by IvenMS - 8 years ago