Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by LanX (Saint)
on Apr 05, 2019 at 15:31 UTC ( [id://1232199]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to escape single quote(s) without the use of quotemeta
in thread How to escape single quote(s) without the use of quotemeta

what about the backslash, do you really want quotemetas behavior?

DB<26> x q(It's\ ) 0 'It\'s\\ ' DB<27> x quotemeta q(It's\ ) 0 'It\\\'s\\\\\\ ' ... DB<29> x quotemeta q(It's\x) 0 'It\\\'s\\\\x'

FWIW you can write a regex which consumes every paired backslash in an or'ed condition before replacing single quotes/backslashes.

But a real test-cases are imperative here.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

update

this shows that the input format should be well defined too

DB<37> dd quotemeta q(It's\x\\) "It\\'s\\\\x\\\\"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-23 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found