How can I search for words in between html tags? Say I have the given strings:
<span style="font-weight: bold;">
<font size="4">Bearings<br /><br /></font>
</span>
<span style="font-weight: bold;">
<font size="4">
Scale Drawing & Error in Measurement<br /><br />
</font>
</span>
<p align="left" class="MsoNormal" style="text-align: left;">
<b/>
<span lang="EN-GB">
<font size="4" class="Apple-style-span">
Solving Equations inc. Quadratic Formula
</font>
</span>
</b>
</p>
How can I search for the titles: Bearings, Scale Draw &l Error in Measurement and Solving Equations inc. Quadratic Formula? Also bearing in mind that the amount of html tags before and after the titles are dynamic meaning they could be anything and there could be any amount. Also, the titles themselves are dynamic, I don’t know what they actually are. I’m searching for them. However, I know that they are at the start of the string, which means I can do something like search for the double quotations and then the right angled bracket “> and then the wildcard * and then the closing bracket and forward slash </
"> * </
Note that I have no idea about regex and I’m just stating that I could do a search on something like that since the VERY FIRST occurrence of </ implies the title is right before that.
You could remove all HTML from your string using
strip_tagsand then search the text.The above will output