From: "Sean Middleditch" <elanthis / awesomeplay.com> > > On Sun, 2001-11-04 at 21:00, Todd Gillespie wrote: > > Would one rather spend some quality time learning to use regexes fully, or > > spend an indefinite amount of time debugging your one-off parser? > > If it takes more time to make such a freakin simplistic parser, the > programmer should consider a different career. Jesus, I wrote things > like that when I was 12. And no, I probably don't know the full extent > of regex's, but since most real code is a hell of a lot easier to debug > and faster and more powerful than what regex's can do, or much less were > designed to, I'll keep regex's where they belong and use some real code > to get the real work done. Hmm, it was a toss-up between, "I find your lack of faith disturbing." and "Come over to the dark side. I am your father's brother's nephew's cousin's former roommate." :-) We just replaced what was a 600+ line inflexible, subset-of-HTML-compliant lexer-in-Java, with a few lines of regexp. The regexp version is HTML 4.0 compliant (and passes all its unit tests :) And so we all wrote parsers the hard way when we were twelve. But regexps have a lot to offer, even if they can't, indeed, do everything. And they look a lot, lot less cryptic after grokking a few rules and patterns about how they're put together. Regards, Darth Bill