Simple regular expression to get text between <br/> and next <br/>
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.
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
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
精彩评论