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

Re: Using special characters in left part of a regex match?

by moritz (Cardinal)
on Feb 06, 2013 at 00:11 UTC ( #1017306=note: print w/ replies, xml ) Need Help??


in reply to Using special characters in left part of a regex match?

$var[$j] =~ s/\.\.\./\.\+/g;

The right half of an s/// substitution is not a regex, but a mere string. So if you want to construct .+ in the replacement, you need to write it as .+ and not at \.\+.


Comment on Re: Using special characters in left part of a regex match?
Select or Download Code
Re^2: Using special characters in left part of a regex match?
by LanX (Canon) on Feb 06, 2013 at 00:14 UTC
    > you need to write it as .+ and not at \.\+.

    He doesn't need to, it's no error.

    But it's better readable w/o escaping.

    Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017306]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2015-07-06 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls