Page 1 of 1

How to remove outer match brackets?

Posted: Sun Feb 14, 2010 7:30 pm
by jwells@nichegroup.com
Is there a way to remove wrapping brackets with one search replace command? Specifically, I would like to replace all occurances of

Code: Select all

htp.p (htf.XXXXX);
with

Code: Select all

htp.XXXXX;
where XXXXX is variable text. So for example:

Code: Select all

target : htp.p (htf.bodyopen);
becomes: htp.bodyopen;

target : htp.p (htf.tableopen (cattributes => 'border="0" cellspacing="0" cellpadding="0" width="100%"'));
becomes: htp.tableopen (cattributes => 'border="0" cellspacing="0" cellpadding="0" width="100%"');

target : htp.p (htf.tablerowopen (cvalign => 'middle'));
becomes: htp.tablerowopen (cvalign => 'middle');
I have a large file that has a lot of these patterns and being able to do a master search/replace would be a huge timesaver.
Thanks,
Jack

Posted: Mon Feb 15, 2010 8:08 am
by ak47wong
Hi Jack,

Find what: htp\.p \(htf\.(.*)\);
Replace with: htp.\1;

Ensure the "Regular expression" check box is selected.

This assumes you are using POSIX regular expression syntax under Configure -> Preferences -> Editor.

Andrew

Thanks, it worked!

Posted: Mon Feb 15, 2010 4:51 pm
by jwells@nichegroup.com
Hi Andrew,
Thanks, that worked like a charm!
Jack