Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: how can I use regular expresion if my string to be matched has round brackets

by lightoverhead (Pilgrim)
on Oct 06, 2008 at 19:06 UTC ( [id://715640]=note: print w/replies, xml ) Need Help??


in reply to Re: how can I use regular expresion if my string to be matched has round brackets
in thread how can I use regular expresion if my string to be matched has round brackets

why it works with
my $ipn=qr/\( going \) there/; or my $ipn=qw/\( going \) there/;
but it doesn't work with
my $ipn="\( going \) there";
Thanks.

Replies are listed 'Best First'.
Re^3: how can I use regular expresion if my string to be matched has round brackets
by GrandFather (Saint) on Oct 06, 2008 at 23:00 UTC

    You need:

    my $ipn="\\( going \\) there";

    The \\ gets replaced by \ when the string is parsed.


    Perl reduces RSI - it saves typing

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-23 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found