Using the function sql_regcase() to convert search patterns into regular expressions
The PHP function sql_regcase() is ideal for regular expression newbies, as it converts any search patter with which it is provided into something a regexp function can use to analyse strings with.
Let's take the following code for instance:
$pattern = "This is my search pattern";
The result of the above code will be:
[Tt][Hh][Ii][Ss] [Ii][Ss] [Mm][Yy] [Ss][Ee][Aa][Rr][Cc][Hh] [Pp][Aa][Tt][Tt][Ee][Rr][Nn]
Now doesn't that save time on having to place every letter into square brackets, and adding it's big or little brother for good measures?