Posted By: Harlequin | Jul 25th @ 9:45 AM
page 1 of 1
Comments: 7 | Views: 504
Harlequin
Harlequin
Don't touch that mustard. It's Jerry and Bills.
In VS2008 I tried a replace using RegEx so clean out HTML comment tags(in a large xaml file).
Regex:
<!--(.|\s)*?-->

This is the expression I found on a website, I made sure the replace box had that checkbox checked to use regular expressions, yet it found no matches. Did I miss something?

Noting that it's from Swansons Illustrator to Xaml plugin so the comment tags do have "start tags" in them like this quick example:
<-- BLAH BLAH <Path> BLAH -->

If that makes a difference in the RegEx not working.
You need to change the regex a bit:

\<!--(.|\s)#--\>

because:

  • <> have special meaning and they need to be escaped
  • *? is not supported but # does the same thing (lazy *)


PS:
I assume "<-- BLAH... " was a spelling mistake, it's missing a ! so it won't match anyway.

One solution is this:

replace \n:b*\n with \n

where :b means space or tab

And speaking of newlines:

The previous regex for comments doesn't handle newlines in comments (and \s is wrong/unneeded), this one does: \<!--(.|\n)@--\>

Try this:

Find what: <{[0-9MC][0-9]*\.[0-9]^2}[0-9]*
Replace with: \1

Of course, I take no responsability if this will replace those digits with a black hole. Proceed with caution Smiley

Here is one good link that talks about RegExp in VSTS 2008. It's part of the MSDN blogs, so it is legit source in my mind.

http://blogs.msdn.com/gertd/archive/2006/11/26/regex-is-your-friend.aspx
page 1 of 1
Comments: 7 | Views: 504