How to regex match text with different endings?
Posted
by Mint
on Stack Overflow
See other posts from Stack Overflow
or by Mint
Published on 2010-04-02T10:07:37Z
Indexed on
2010/04/02
10:13 UTC
Read the original article
Hit count: 269
This is what I have at the moment.
<h2>header</h2>\n +<p>(.*)<br />|</p>
^ that is a tab space, didn't know if there was
a better way to represent one or more (it seems to work)
Im trying to match the 'bla bla.' text, but my current regex doesn't quite work, it will match most of the line, but I want it to match the first
<h2>Information</h2>
<p>bla bla.<br /><br /><a href="http://www.google.com">google</a><br />
or
<h2>Information</h2>
<p>bla bla.</p> other code...
Oh and my php code:
preg_match('#h2>header</h2>\n +<p>(.*)<br />|</p>#', $result, $postMessage);
© Stack Overflow or respective owner