Devator
Devator

Reputation: 3904

How do I find a string in string with regex?

So, I have a full HTML page as "string". I want to have everything between

haalt" border=0px/>

and

</tr>

I've tried the following regexes:

haalt" border=0px/>(?s)</tr>
and
haalt" border=0px/>(.*?)</tr>

But none of them worked. And yes, I am a newb at regexes.

AutoIt code

    Local $aStrings = StringRegExp($vBron, 'haalt" border=0px/>(?s)</tr>', 3)

The 3 in the end means "Return array of global matches."

Thanks in advance!

Upvotes: 1

Views: 739

Answers (1)

Tim Pietzcker
Tim Pietzcker

Reputation: 336108

What about

haalt" border=0px/>(?s)(.*?)</tr>

You need to a) tell the regex engine to make the dot match newlines ((?s)) and b) tell the regex engine to actually match something ((.*?)).

Upvotes: 2

Related Questions