On Sat, 23 Apr 2011 17:39:36 +0200, Rambo <[email protected]> wrote:
Is there any way to implement recursive patterns in regular expressions? [1]
No. JS RegExps does not have that feature.
I want to build a template engine which supports if/else/foreach statements that can be nested. I've done that in PHP using regular expressions, but I cannot figure out how to do this in JS withoutsupport for recursive patterns. Any ideas?
I'd build a real parser. You can use a RegExp to do tokenization, but do the complex logic in real code. Trying to solve a complex problem with RegExps just means that you now have two problems. RegExps aren't exactly easily maintainable - more like write-only code, even less readable than perl code. /L -- Lasse Reichstein Holst Nielsen - [email protected] -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
