Page 1 of 1

div statement wildcards?

Posted: Tue Aug 30, 2016 5:13 pm
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

Posted: Tue Aug 30, 2016 9:46 pm
by bevhoward
Looks like

Code: Select all

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

Beverly Howard

Posted: Tue Aug 30, 2016 11:04 pm
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.

Posted: Tue Aug 30, 2016 11:46 pm
by bevhoward
Thanks... the education is appreciated.

Beverly Howard