I am searching through a large codebase in Eclipse, using its RegEx search functionality. I need to find <script> tags that do not have a src attribute. I am new to RegEx, but have been able to hack something together:
^.*(^<script(?!.*src).*)$
This matches the tags I am looking for, but only if there is nothing on the line before the <script> tag. If there are spaces or anything, it doesn’t match.
Matches Correctly:
<script type="text/javascript">
Does Not Match:
<script type="text/javascript">
How can I modify my expression so that it matches in any part of the line?
I’ve also tried prepending ^, \s*, [ ]*, and (?x) with no success.
Safe way would be to use regex pattern
(<script\b(?![^>]*\bsrc=)[^>]*>)