Perl DBI how to escape single SQL quotes with regex

SQL escapes single quotes by replacing them with double single quotes. Search for Gigi D’Agostino should look like this:

In Perl the easiest way it to add the escaped quotes is by using a simple regex.


A complete different approach would be the use a bound query and DBI will do the escaping.


(170 Posts)

20 years of coding and working as software engineer but I am still eager to learn more. I am very passionate when it comes to open source, Linux and Java. But I made my peace with Windows long ago to fully enjoy my PC gaming hobby. I have a soft spot for 90s electronic music and Babylon 5. In the evenings you will find me roaming the endless space in Warframe (IGN k05h).