Help with Regular Expression

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
mo
Posts: 306
Joined: Tue Mar 11, 2003 1:40 am

Help with Regular Expression

Post by mo »

I cannot work out the regular expression that would do the following:

Given a line that looks like this:
<p class="mozp">(Gavesisuttam)</p>

I want to end up with a line that looks like this:
<h4>Gavesisuttam</h4>

I cannot look just for "<p class="mozp">" as it occurs on every line.

The unique thing in this line is the "suttam)"

I have tried variations of the following:

^<p class="mozp">(\<[.*]suttam)</p>$
^<p class="mozp">\(\<[.*]suttam\)</p>$
^<p class="mozp">\\(\<[.*]suttam\\)</p>$
^<p class="mozp">\([.*]suttam\)</p>$
^<p class="mozp">\\([.*]suttam\\)</p>$

^<p class="mozp">\(\(\([^<]+\)suttaµ\)</p>$

Any help would be appreciated.
Best Wishes!
Mike Olds
User avatar
bbadmin
Site Admin
Posts: 1022
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

Try this, using POSIX syntax:

Find what: <p class="mozp">\((.+)suttam\)</p>
Replace with: <h4>\1suttam</h4>

or this, with non-POSIX syntax:

Find what: <p class="mozp">(\(.+\)suttam)</p>

Keith MacDonald
Helios Software Solutions
mo
Posts: 306
Joined: Tue Mar 11, 2003 1:40 am

Post by mo »

Thanks Keith that works fine. Saves me a huge amount of work.

Any guidelines as to when one should be using POSIX? I don't because I havn't, not because I know why not.

mo
Best Wishes!
Mike Olds
User avatar
bbadmin
Site Admin
Posts: 1022
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

Using POSIX syntax is just a matter of preference. One way or the other you have to escape brackets!

Keith MacDonald
Helios Software Solutions
Post Reply