From: "Hal E. Fulton" Date: 2003-04-17T06:31:23+09:00 Subject: Re: regular expressions ----- Original Message ----- From: To: "ruby-talk ML" Sent: Wednesday, April 16, 2003 12:33 PM Subject: Re: regular expressions > I have a few questions -- sort of just "academic" interest, as I am > (as you know) one of those freaky people who think regular expressions > are incredibly cool and elegant and have no intention of abandoning > them :-) > I'll give you my opinion, speaking for no one else's idea or project. Regexes are fine, and I wouldn't want to abandon them. It's the notation that makes my eyes hurt. It looks like line noise. It's dense, terse, compressed, cryptic. > The questions being... what exactly would be happening in the above? > In what sense is it a "language"? I'd like to write a complex regex in a more readable form which could then be "compiled" to a Ruby regex. (Now that I think about it, the analogy between regex notation and machine language is not a bad one.) Now, I'll be the first to admit that it most cases, it just doesn't matter much. Most of the time I would still use a "plain" regualr expression. But there is a complexity threshold where I would rather have a more verbose, readable, multi-line notation. Whether it's considered a "language" is debatable -- in fact, the same is true for programming "languages" in general. ;) > And at what point would you be > matching something? Could you show a mock-up example of a whole real > case? Now you're asking me to invent syntax on the spur of the moment. I'm not good at that. :) Here's a very rough first effort. (One too simple really.) phone = RegexLang.new(< Do you know the way to San Jose? Take a left turn at Albuquerque, and make sure Bugs Bunny is following you. Hal