Apocalypse 5

Allison Randal al at shadowed.net
Thu Jun 6 13:45:16 CDT 2002


On Thu, Jun 06, 2002 at 11:53:45AM -0500, Mancini, Peter M wrote:
> I heard the changes to regexp were pretty fundamental.  Has anyone looked at
> it yet?  I am working 16 hours a day right now so I haven't had time to
> check it out.  Anyone got a personal report?

They are pretty fundamental changes. If you don't have time to read the
Apocalypse, I'd say the most important paragraph is:

"I need to warn you that this Apocalypse is going to be somewhat radical.
We'll be proposing changes to certain "sacred" features of regex
culture, and this is guaranteed to result in future shock for some of
our more conservative citizens. Do not be alarmed. We will provide ways
for you to continue programming in old-fashioned regular expressions if
you desire. But I hope that once you've thought about it a little and
worked through some examples, you'll like most of the changes we're
proposing here."

And I do like them. The biggest change is more a change of philosophy
than of syntax "Regexes aren't strings, they're programs." All the
changes grow out of this one idea, to make regexes not just more
powerful, but more usable.

So, alot of little changes, yes, but if you lean back a bit from the
details, you'll suddenly see a logical system, a language even.
Overall, it's more yacc-ish than sed-ish. This is progress. :)

A few quick highlights:
- You can capture values to named variables right in the middle of the
  regex: /$word:=(\w*)/
- /x is now on by default, so you'll have much more readable regexes
- All the final modifiers have been moved to the front s:g/// instead of
  s///g, and we're not limited to single letter modifiers anymore
- {...} is now used for Perl code within regexes (this makes sense)
- <n,m> replaces {n,m} for user defined quantifiers
- All those obscure little (?whatever) have been replaced with more
  meaningful structures
- [...] is now non-capturing grouping (what a novel idea, make a 
  common structure easy to write)
- And character classes are now <[...]> which fits nicely with the
  general syntax of <...>, even if you do have to type a little more. 
- And if you don't like all the changes, you just type s:p5/// and
  everything works the old way.

There's lots more. I'm quite happy with it. :)

Allison

---
To unsubscribe from this list, send an email to
majordomo at hfb.pm.org with the following body:
        unsubscribe nashville-pm-list <emailaddresstounsubscribe>



More information about the Nashville-pm mailing list