Converting eregi() to preg_match()

Hi all,

I’m new to PHP and to SitePoint so please bear with me.

I’m trying to convert a couple of eregi() functions to preg_match()

The functions are:

eregi("\n", $s)
eregi("%0a", $s)

I know I need to include the delimiters and a trailing ‘i’…

preg_match("/\r/i", $s)
preg_match("/%0a/i", $s)

Given that I’m using double quotes here, do I need to add some escape characters? If so, how many?

Many thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.