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

Re: Substitution Question

by pfaut (Priest)
on May 05, 2003 at 20:55 UTC ( #255756=note: print w/replies, xml ) Need Help??


in reply to Substitution Question

If you are doing this to insert the data in a database, I'd recommend making the problem go away by learning how to use placeholders. Look in Tutorials for guides on using DBI and placeholders.

Anyway, this regex should do what you want.

$artist =~ s/'/\\'/g;

You may also have to do substitutions for the escape character itself if it might ever appear in any of your strings.

90% of every Perl application is already written.
dragonchild

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2021-02-27 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?