0

Does someone know how to check if a code begins by <script> and end by </script>. It's just a means to check if code is ok to be inserted in HTML to avoid breaking the site.

So far I've tried to look if <script> is there but I need to check both opening and closing.

Any help would be cool :)

calo
  • 141
  • 1
  • 10

1 Answers1

5

You could use this..

<script[^>]*>([\s\S]*?)<\/script>
hwnd
  • 69,796
  • 4
  • 95
  • 132