Php - Delimiter must not be alphanumeric or backslash -


this question has answer here:

this question has been asked don't know how fix problem in situation. getting following php errror:

php message: php warning: preg_match(): delimiter must not alphanumeric or backslash in... on line 227

line 227 following:

if (preg_match($match, $_server['http_user_agent'])) 

and function:

$oslist = array ( 'windows 3.11' => 'win16', 'windows 95' => '(windows 95)|(win95)|(windows_95)', 'windows 98' => '(windows 98)|(win98)', 'windows 2000' => '(windows nt 5.0)|(windows 2000)', 'windows xp' => '(windows nt 5.1)|(windows xp)', 'windows server 2003' => '(windows nt 5.2)', 'windows vista' => '(windows nt 6.0)', 'windows 7' => '(windows nt 7.0)', 'windows nt 4.0' => '(windows nt 4.0)|(winnt4.0)|(winnt)|(windows nt)', 'windows me' => 'windows me', 'open bsd' => 'openbsd', 'sun os' => 'sunos', 'linux' => '(linux)|(x11)', 'mac os' => '(mac_powerpc)|(macintosh)', 'qnx' => 'qnx', 'beos' => 'beos', 'os/2' => 'os/2' );  foreach($oslist $curros=>$match) {  if (preg_match($match, $_server['http_user_agent'])) { break; } } 

make sure proper escapes on needs escaping. escape

os/2 os\/2  7.0 7\.0  etc. 

. / ? * etc etc special preg, should not use them in pattern unless escape them or when want use "special powers"

update: had put in codeblock see escapes ;)


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -