Am 05.01.2015 um 22:13 schrieb John Hardin:
On Mon, 5 Jan 2015, Bowie Bailey wrote:You can avoid having to escape the slash (/) by using a different separator for the regex. This can avoid "leaning toothpick syndrome." For example: m#http://match/this/url/#Ouch. # won't work for that (in SA at least) as it comments out the rest of the RE.
which means # needs to be escaped too... thanks! [harry@srv-rhsoft:~]$ php -r 'echo preg_quote("#");' # function sa_quote($input) { $input = str_replace(array("\n", "\r", "\0"), '', trim($input)); $input = str_replace("\t", ' ', $input); $input = preg_quote($input); $input = str_replace('/', '\/', $input); $input = str_replace('@', '\@', $input); $input = str_replace('%', '\%', $input); $input = str_replace('#', '\#', $input); return $input; }
signature.asc
Description: OpenPGP digital signature