警告:preg_match():编译失败:偏移量为0的不匹配括号

Hello can some 1 help me out with this ?

Warning: preg_match(): Compilation failed: unmatched parentheses at offset 0 in .. at line 112

this is at that line !

if(preg_match("/%/", $url) || preg_match("/;/", $url) || preg_match("/)/", $url))

i already changed something at this point

This is the reall code befor adding !

if(preg_match("%", $url) || preg_match(";", $url) || preg_match(")", $url))

i hope some 1 can help me out here !

kind regards ropin

You have to escape parentheses because These are Special character in regex.

if(preg_match("/%/", $url) || preg_match("/;/", $url) || preg_match("/\)/", $url))

You would have to escape parentheses in your regex, but I think what would be simpler is this:

if(preg_match("/(%|;|\))/", $url))