Complete PHP newbie here trying to get to grips with literals and escapes, so apologies in advance that this is so basic. I've read lots of questions on preg_match
but none seem to address this.
I have an old form which contains instances of the deprecated eregi()
function using double quotes:
eregi("\n", $s)
eregi("%0a", $s)
Those 2 lines are part of a longer line to check for injection characters.
If I update the function to preg_match
with delimiters and a trailing i
, like so:
preg_match("/\n/i", $s)
preg_match("/%0a/i", $s)
Do I now also need to escape the \
and/or %
with my own back slash(es)?
Thanks