views:

117

answers:

2

I'm working on using Find/Replace to change a bunch of labels to DataBound text.

Basically I'm trying to convert something like

<asp:Label ID="lbl213" runat="server" />

to

<%# Eval("_213")%>

Here's my regex

<asp:Label ID="lbl{\d*}" runat="server" />

Here's my replace

<%# Eval("_\1")%>

Here's my Error

Unknown argument for ':' operator. Complete Regular Expression required in the search string.

How would I resolve this?

EDIT:
I also tried the following

<asp{\:}Label ID="lbl{\d*}" runat="server" />

but the response is that

The specified text was not found.

+1  A: 

Well holy crap. You basically have to escape EVERYTHING that's not a text character

\<asp\:Label ID\=\"lbl{:z}\" runat\=\"server\" \/\>
rockinthesixstring
Oh, wonderful! Good that you got it working at least.
crimson_penguin
Be aware that Visual Studio's regex flavor is very atypical. In most of the regex flavors you see mentioned here, the colon and angle bracket characters have no special meaning unless they're part of some regex construct like `(?:...)` (non-capturing group) or `(?<=...)` (lookbehind), so there's no need to escape them.
Alan Moore
A: 

The expression:

\<asp\:Label ID="lbl{:d+}" runat="server" /\>

will work just fine as well. You only need to escape the colon and the angle brackets.

Dan Story