I use a function to get the first "x" words of a string. Main part is:
preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
When a word is inside html - example:
<a href="/"><u>Linktext</u></a>
The regex see the word "linktext" as a word. Regex should be changed to skip every word that is inside a html tag.
Is this possible?