how can i extract "123 abc" from this text ? <p class="test">some text<font style="color:#1E9A9F;">| 123 abc</font></p>
Well I don't know of any way you could extract that certain bit of text exactly but you could either user striptags which would return "some text| 123 abc" if you echoed it or if your looking to see if 123 abc exists in that string of text, then it is fairly easy using strpos which will return true or false. You could then use that to do whatever you want.
try this one: <?php $content = '<p class="test">some text<font style="color:#1E9A9F;">| 123 abc</font></p>'; $find_this = '/<p class="test">some text<font style="color:#1E9A9F;">\| (.*)<\/font><\/p>/'; if (preg_match($find_this, $content, $matches)) { echo $matches[1]; } ?> PHP:
preg_match('~<p class="test">some text<font style="color:#1E9A9F;">\| ([^<]+)</font></p>~', $text, $output); echo $output[1]; PHP: