我正在尝试将preg_match检查从url检查更改为用户名检查,用户名长度应该在2-16个字符之间,并且可以包含破折号、空格和连字符。但是我遇到了以下错误:
警告:preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 14
if(empty($string) || preg_match("#^([\w- ]{2,16}*(?:.[\w- ]{2,16}*)+):?(d+)?/?#i", $string))
查找URL的旧代码
if(empty($string) || preg_match("#^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?#i", $string))