Re: RFC 145 (alternate approach)
[email protected] (Nathan Wiger) Tue, 05 Sep 2000 11:38:54 -0700
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Organization | Sun Microsystems |
| Message-ID | <[email protected]> |
Eric Roode wrote: > > Unfortunately, as Richard Proctor pointed out, ?m is taken. Perhaps > (?[list|of|openers) and (?]list|of|closers) ? > > Does that look too bizarre, with the lone square bracket in each? > Or does that serve to make it mnemonic (which is my intention)? Actually, I personally like this, and was on the verge of suggesting similar myself, believe it or not. It makes a lot of sense to me. I don't like the m vs M because that smacks too much of negation for my tastes. > And --- can-of-worms time --- we're only intending the list elements > to be constant characters, but that syntax *looks* like it can take a > regular expression for any of the list elements Now *that* sounds cool, I like it! What if the RFC only suggested the addition of two new constructs, (?[) and (?]), which did nested matches. The rest would be bound by standard regex constructs and your imagination! /(?[\d+)[\s\w]+?(?])/ Would match 01HelloThere10 999 Important Mesage 999 But not 01HelloThere01 999 Important Message 9 That is, the ?] simply takes whatever the closest ?[ matched and reverses it, verbatim, including ordering, case, and number of characters. The only trick would be a way to get what "reverses it" means correct. > Sound about right? I think I'm really starting to like this now... :-) -Nate