Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001162]
help
Chatterbox?
What's the matter? Cat got your tongue?...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-06-22 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (523 votes). Check out past polls.