March 17, 20179 yr Hi all. I'm not a PHP person so please bear with me. I need to remove eregi() and replace it with preg_match(). The line that needs updating is: return (eregi("\r", $s) || eregi("\n", $s) || eregi("%0a", $s) || eregi("%0d", $s)) ? TRUE : FALSE; Would the following be correct and achieve the same as the above? return (preg_match("/\r/i", $s) || preg_match("/\n/i", $s) || preg_match("/%0a/i", $s) || preg_match("/%0d/i", $s)) ? TRUE : FALSE; As you can see, I've just added delimiters and a trailing 'i', but I'm not sure whether I need to escape anything, bearing in mind it's using double quotes. If anyone can point me in the right direction I'd appreciate it. Thanks.
March 19, 20179 yr Author OK ignore the above, let's make this simpler I just need to update the following two to preg_match() eregi("\n", $s) eregi("%0a", $s) General rule is to add delimiters and a trailing 'i', like so.. preg_match("/\r/i", $s) preg_match("/%0a/i", $s) But in addition to this, do escapes (how many?) also need to be added before the \r and %0a? Edited March 19, 20179 yr by Spinoza
Create an account or sign in to comment