I am in need of a regular expression that can specifically match the text "my company" within a string, while excluding occurrences within image or anchor tags.
My current attempt is failing with this expression:
/(?!]<em>?>)(my company)(?![^<]</em>?</a>)|(?!]<em>?>)(my company)(?![^<]</em>?</a>)/i
The issue lies with the above pattern matching "my company" within figtitle="test my company testing". This should be avoided.
The string I am working with looks like this:
<img fid="32" class="imgClick img-report img-responsive" figkey="rId52" figtitle="test my company testing"> my company <a src="http://my company"> my company</a>
Testing ongoing at: