0

Using Sharepoint Designer 2007. I have the following block of code taken from a C# app:

sbuilder.Append("x");
sbuilder.Append("y");
sbuilder.Append("z");

and so on. I'm translating it to Javascript. I would like to change each sbuilder reference to just a regular string concatenation, e.g.

s += "x";
s += "y";
s += "z";

Using regular expressions with Find/Replace, I can set the Find expression to:

sbuilder[.]Append[(].*[)]

but how do I build the Replace expression so that the inner content of the parentheses is preserved?

0

Find

sbuilder[.]Append[(]{.*}[)]

Replace

s += \1

You can use {} to specify which substring you want to use in the replace. Adding another {} would work too, and you can use \2 to use that substring.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.