I've found the bug in my PCRE patch, which is partly to do with the way * repetitions are handled. But you don't actually need to use iterative repetitions any more, because you can replace iteration with recursion!
£^(<\w+/>|<(\w+)>([^<>]|(?1)|)(?3)</\2>)$£
I'll fix the bug soon...
I've also managed to prove that all context-free languages can indeed be expressed. The proof takes the form of an algorithm for turning a context-free grammar into a regex:
becomes
/(|\(((?1)|x(?2))\)(?1))/
Of course, the interesting part is proving that the algorithm really works. I plan to write it up in more detail soon.
More regex 0 Comments More | Login | Reply /