Posted By: Harlequin | Aug 14th @ 9:56 AM
page 1 of 1
Comments: 10 | Views: 852
Harlequin
Harlequin
http://twitter.c​om/TrueHarlequin

 x:Uid="XXXXX"

 

I want to remove all these tags from a Xaml file. Is there a regex I can use to take them all out? XXXXX can be anything. And note a space before the x.

ktr
ktr
two sides to everything

Regex:

\s+x:Uid=\"[^\"]+\"

 

in C#:

var regex = "\\s+x:Uid=\\\"[^\\\"]+\\\"";

... try that

 

Edit: Updated regex.

ktr
ktr
two sides to everything

Hmm.. that is strange.  That is definitely the right expression.  It works with C#'s regex engine and Javascript's engine too.  I tried using it in VS2008's find dialog and I got the same error.  I don't know how to fix that.  I think they have some custom searches you can perform that are prefixed with a colon.  That kind of botches the regex functionality...

ktr
ktr
two sides to everything

Ok.. i finally figured it out... VS has a different syntax for finding whitespace (:Wh).  Anyway, here it is (this will only work in the find dialog):

 

:Whx\:Uid="([^"]|:Wh)*"

Sven Groot
Sven Groot
My name has 9 letters. Coincidence? I think not...

Visual Studio's find dialog uses a different regex syntax. This ought to do the trick:

 

:b+x\:Uid="[^"]+"

ktr
ktr
two sides to everything

Not when there are newlines between the quotes.

Sven Groot
Sven Groot
My name has 9 letters. Coincidence? I think not...

If there are newlines between the quotes, then it isn't a valid XML file. Smiley

what kind of vacation is that without a laptop with Visual Studio connected to the internet? Big Smile

page 1 of 1
Comments: 10 | Views: 852
Microsoft Communities