Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^3: Regex help/ Lua parse

by kcott (Chancellor)
on Oct 27, 2012 at 04:55 UTC ( #1001162=note: print w/replies, xml ) Need Help??

in reply to Re^2: Regex help/ Lua parse
in thread Regex help/ Lua parse

I don't think that construct has a specific name - it's just using parentheses to change precedence. Usage examples for s/// can be found in Regexp Quote-Like Operators; examples for y/// (although its synonym tr/// is used in these examples) can be found in Quote-Like Operators.

In Perl 5.14.0, an r option was introduced (see perl5140delta under Core Enhancements - Regular Expressions - Non-destructive substitution). This makes the following equivalences:

# For y/// (my $x = $y) =~ y///; my $x = $y =~ y///r; # Ditto for its synonym tr/// (although not mentioned in perl5140delta +) (my $x = $y) =~ tr///; my $x = $y =~ tr///r; # And for s/// (my $x = $y) =~ s///; my $x = $y =~ s///r;

The first two links above are for the current Perl version (5.16.0 at the time of writing) so they have examples of this also.

-- Ken

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001162]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2018-04-27 07:33 GMT
Find Nodes?
    Voting Booth?