preg_match Unknown modifier '['
I use the following code
$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;
}
}
And the expression is supposed to match the following examples
Class Instance [notbrowsable]
Class Accoutrement : Instance
Class PlayerGui : BasePlayerGui [notCreatable]
...
Why is my regular expression giving me this error? I can't find the fault.
No comments:
Post a Comment