Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegExp pattern to find ASP tags

Status
Not open for further replies.

Humlan

Programmer
Nov 14, 2003
18
SE
I'm trying to modify an ASP classic file search engine ( since it now finds VB code inside the files. I'm trying to change the regular expression pattern used to avoid searching inside HTML tags to also include <% VBScript tags %>.
Code:
[b]Original code[/b]
'objRegExp.Pattern = "<[^>]*>"
'strFileContents = objRegExp.Replace(strFileContents,"")

[b]Modified code (not working)[/b]
objRegExp.Pattern = "<\%[^>]*\%\>"

Trying to escape the percentage signs with backslashes doesn't really work, and after Googling for an hour, I'm stuck.

Any regexp wizards hovering around? :)
 
I don't think you need to escape % at all?! Just do it simply like this.
[tt] objRegExp.Pattern = "<%[^>]*%>"[/tt]
Or I miss the point.
 
If I don't escape the tags, IIS will think they are ASP tags...
 
What about and what happens if all escaped?
[tt] objRegExp.Pattern = "\x3C\x25[^\x3E]*\x25\x3E"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top