Reputation: 901
I am trying to find all instances of <script>
in my solution in Visual Studio 2010. Here are the steps I take:
<script
into the "Find what:" textboxI only get results where <script>
is in a string (i.e. var foo = "<script>do something</script>
, where <script>
was the only html tag in a .cshtml file, or where <script>
is in a comment (i.e. //Close the <script> tag
).
I tried a Regular Expression search with \<script\>
which yielded 0 results. I've had the same results searching for <a>
. I haven't done an exhaustive test of the Visual Studio 2010 search with all html tags, but it seems to be equally broken for all html tags.
How can I find what I'm looking for in my source code?
Upvotes: 0
Views: 656
Reputation: 4951
My guess is that your script tags are defined like this
<script type="text/javascript"></script>
Instead of this:
<script></script>
So try this out with Use Regular Expressions checked in the Find Options:
\</*script[ ]*.*\>
<script>
tags. Be careful if you're trying to do a find and replace, though. When I ran it, I got some results from within a couple third party javascript files (including knockout).
I know it's not exactly the best regex syntax, but the Visual Studio find syntax is apparently different from the regular .NET regex.
Upvotes: 1