Despite using PHP for years, I\'ve never really learnt how to use expressions to truncate strings properly... which is now biting me in the backside!
Can anyone prov
You could use substring in combination with stringpos, eventhough this is not a very nice approach.
Check: PHP Manual - String functions
Another way would be to write a regular expression to match your criteria. But in order to get your problem solved quickly the string functions will do...
EDIT: I underestimated the audience. ;) Go ahead with the regexes... ^^