I wrote a script for a list of allowed HTML recently and I'm wondering if anyone with a bit more experience than me could compare the three regex (All work) that I wrote to aquire the non-self closing tags, and tell me which one is likely to incur the least overhead - because this will be going into effect for user comments and could end up looping several hundred times on (some) page loads.
In use:
/<([^ \/>]+)([^>]+)?>(?m)([^(\<\/\\1\>)]+)(?-m)<\/\\1>/is
Others:
/<([^ \/>]+)([^>]+)?>(?m)(.*?)(?-m)<\/\\1>/is
/<([^ \/>]+)([^>]+)?>(?m)(.*?(?!<\/\\1>).*?)(?-m)<\/\\1>/is
Cheers in advance,
Mike