(.[^\n]*?)\[code](.*?)\[\/code](.[^\n]*?)(*SKIP)(*F)|(.[^\n]*?)\[php](.*?)\[\/php](.[^\n]*?)(*SKIP)(*F)|some_rules_here
The pattern above makes the function work too slow.
With it: http://regex101.com/r/qP4tT5/1 Page gets loaded in more than 3 seconds. Regex debugger says it took 5153 steps in total to execute the regex.
Without it: http://regex101.com/r/fG4tW0/1 Page gets loaded in only 0,3 seconds Regex debugger says it took only 4 steps to execute the regex.
Why do I have to use it:
Because if the emoticon's shortcut is inside a [code]
or [php]
tag, it shouldn't be HTMLed.
Is there an alternative method which does the same thing faster?