1

I have the following text in Visual Studio Design View:

<% =Utility.CreateLabel("lblHeader_LP","Online Loan Application") %>

and I need to convert that text into the following:

<asp:Label ID="lblHeader_LP" Text="Online Loan Application" runat="server"/>

I am not really sure how to accomplish that but thinking the following:

Find: <% =Utility.CreateLabel("(*.)","(*.)" &>

Replace: <asp:Label ID="$1" Text="$2" runat="server" />

Any idea?

2 Answers 2

1

Try using this for your find:

<% =Utility\.CreateLabel\("([^"]*)","([^"]*)"\) %>
Sign up to request clarification or add additional context in comments.

2 Comments

Here is the answer. Thanks. Helped me save too much time.
Thanks for this answer but didn't work for the Replace case. It finds the text but when coming to replacing, it didn't work so I used what Microsoft says mentioned in my answer.
1

This is what worked for me, I think Visual Studio accepts different kind of Regular Expression :

Find: \<% =Utility\.CreateLabel\({:q},(:b)*{:q}\) %\>

Replace: <asp:Label ID=\1 Text=\2 runat="server" />

Where {:q} means quoted-text for back-reference and (:b) means space or tab character.

Source: http://msdn.microsoft.com/en-us/library/2k3te2cs(VS.80).aspx

1 Comment

yes - leave it to Microsoft to create (or buy and continue to use) a regular expression language unlike any other in their flagship IDE, which is designed to compile multiple languages which all use a regular expression syntax completely different from the IDE itself but identical to each other... grumble

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.