visual studio Regex Find/Replace error
-
23-09-2019 - |
문제
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.
해결책
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.
다른 팁
Well holy crap. You basically have to escape EVERYTHING that's not a text character
\<asp\:Label ID\=\"lbl{:z}\" runat\=\"server\" \/\>
제휴하지 않습니다 StackOverflow