Hi Jonathan, Jonathan Levinson wrote: > I noticed that if one is not careful in one's regular expression use, > the compilation for a regular expression can take minutes. I'm not > talking about applying the pattern just compiling it! > > > > Should regular expressions be avoided altogether and should one use > hand-crafted state machines for parsing, and tokenizing, or can regular > expressions be used as long as one is careful?
I’d say, use regular expressions as long as they are not too complex. But I guess you’re mentioning that in the context of property parsing, in which case I don’t think regular expressions are the ultimate answer. A proper lexer is likely to be needed, either generated or written by hand. As the latter solution quickly becomes a maintenance nightmare, some lexer generator will probably be needed. Question remains, which one, and I’m not even sure there’s one that exists whose license is ASLv2-compatible. Plus there are some issues specific to property parsing, like shorthands (which should ideally re-use the parsers of the individual properties), sub-properties, etc. Vincent
