in reply to Re^3: RFC: named pattern match tokens
in thread RFC: named pattern match tokens

I don't like the list-context regexp matching feature, and try to always avoid it.

One disadvantage of the () = /regex/ syntax is that it does not work for continued (/g) matching. () = /regex/g does something else. Is is usually not easy to convert a /g matching to a matching not using /g.

I however don't understand what you say about hashes not interpolating. You certainly wouldn't want a whole hash to interpolate at once, only a hash element, which can be interpolated like "John is $john{age} years old."

Btw, the ruby syntax for interpolating arbitary code is #{CODE}, and I think the perl6 syntax will be $(CODE) but I don't really follow p6 news so I'm not sure.

Replies are listed 'Best First'.
Re^5: RFC: named pattern match tokens
by revdiablo (Prior) on Oct 05, 2004 at 19:59 UTC
    One disadvantage of the () = /regex/ syntax is that it does not work for continued (/g) matching.

    It doesn't? Maybe I'm not understanding what you're getting at, but this works just how I'd expect:

    print "foo bar" =~ /(\w+)/, "\n"; # prints "foo" print "foo bar" =~ /(\w+)/g, "\n"; # prints "foobar"