How to remove outer match brackets?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
jwells@nichegroup.com
Posts: 2
Joined: Sun Feb 14, 2010 7:01 pm

How to remove outer match brackets?

Post 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
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post 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
jwells@nichegroup.com
Posts: 2
Joined: Sun Feb 14, 2010 7:01 pm

Thanks, it worked!

Post by jwells@nichegroup.com »

Hi Andrew,
Thanks, that worked like a charm!
Jack
Post Reply