div statement wildcards?

General questions about using TextPad

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

Post Reply
User avatar
bevhoward
Posts: 27
Joined: Tue Oct 05, 2004 6:38 pm
Location: Austin, Texas, USA
Contact:

div statement wildcards?

Post by bevhoward »

Can someone help with the syntax for finding complete div statements using wildcards?

An example is;

Code: Select all

<div class="ygrps-yiv-966925050yiv2931130974MsoNormal"><br><br></div>
...where the text after the

<div class="ygrps-

is unpredictable, so, what I need is a wildcard statement to match anything between;

<div class="ygrps-
and
</div>

I am sure that part of the problem is that there are instances of nested brackets within these cases.

I've been though the help file on regular expressions several times today and I do have a fair amount of experience with expressions, but everything I have tried today fails.

Thanks in advance,
Beverly Howard
User avatar
bevhoward
Posts: 27
Joined: Tue Oct 05, 2004 6:38 pm
Location: Austin, Texas, USA
Contact:

Post by bevhoward »

Looks like

Code: Select all

<div class="ygrps-.*/div>
works

Beverly Howard
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

If a line contains more than one div element your regex will match from the beginning of the first one to the end of the last one.

To match the individual div elements separately, try
<div class="ygrps-.*?></div>

The * operator matches as much as possible; the *? operator matches as little as possible.
User avatar
bevhoward
Posts: 27
Joined: Tue Oct 05, 2004 6:38 pm
Location: Austin, Texas, USA
Contact:

Post by bevhoward »

Thanks... the education is appreciated.

Beverly Howard
Post Reply