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

Re: How to escape single quote(s) without the use of quotemeta

by hippo (Bishop)
on Apr 05, 2019 at 14:43 UTC ( [id://1232193]=note: print w/replies, xml ) Need Help??


in reply to How to escape single quote(s) without the use of quotemeta

Is this what you are after?

use strict; use warnings; use Test::More tests => 1; my $have = "This sting it's bothering to escape ' single characters"; my $want = "This sting it\\'s bothering to escape \\' single character +s"; $have =~ s/'/\\'/g; is $have, $want;

Replies are listed 'Best First'.
Re^2: How to escape single quote(s) without the use of quotemeta
by thanos1983 (Parson) on Apr 05, 2019 at 14:49 UTC

    Hello hippo,

    Thanks it works. I thought also about escaping the back slash character and I have tried it but it did not worked for me. I guess s and g is what I was looking for.

    Thanks again for your time and effort.

    BR / Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-16 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found