我用下面的代码的preg_match未知的修饰词“[”
$api_dump_reader = fopen($api_path, "r");
$content = fread($api_dump_reader, filesize($api_path));
$api_lines = explode("\n", $content);
foreach($api_lines as $line)
{
if (preg_match("(Class) [a-zA-Z]+ (\: [a-zA-Z]+)? (\[[a-zA-Z+]\])?", $line))
{
echo $line;
}
}
而且表达应该符合下面的例子
Class Instance [notbrowsable]
Class Accoutrement : Instance
Class PlayerGui : BasePlayerGui [notCreatable]
...
为什么我的正则表达式给我这个错误?我无法找到故障。
你需要使用delimeters,如'/,#',, – 2013-08-22 07:38:47
缺失的分隔符肯定是*杀死*错误,但RegExp本身也需要调整,请参阅下面的文章。在这方面,在这个问题上“比”重复的问题更多。 – cars10m