On Sun, 2001-11-04 at 23:04, Bill Kelly wrote: > > 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." Dude, that girl is a freak. I hope you're not her. ~,^ > > :-) > > 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 :) Well, that certainly is an achievement. I can see where regex's would be better for a task like that. > > 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. Yes, but for the CSV thing, and a lot of other tasks, the regex's are a lot more complicated and less efficient than a simplistic hand-written parser. I certainly wouldn't suggest writing one's own parser for, say, Java; but neither would I suggest using a regex. ^,^ > > > Regards, > > Darth Bill > > Sean Etc.