Reputation: 8754
I have a string that contains this (and another things):
<b>SINOPSIS:</b><br/>
Text text text and mooore text...<br/>
I need a reg-ex to get the text between those first two <br/>
tags.
Thanks...
Note: There are more <br/>
tags. I need the first occurrence only..
I will be using PHPs preg_match() function.
Upvotes: 1
Views: 1948
Reputation: 1817
this will work, make sure to enable multiline
there are other fancier ways with more checks ect...
edit:
preg_match('!\<br\/\>.+?\<br\/\>!s', $string);
Example 2 (For whitespace before close br
),
!\<br\s*/?>.+?\<br\s*/?>!s
Upvotes: 1
Reputation: 2213
Allow me to point you to this brilliant answer by bobince that I stumbled upon when I was tempted to ask a similar question: RegEx match open tags except XHTML self-contained tags
Upvotes: 0