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.

1 One person thinks it's helpful 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *