I wanna catch Php classes from a file:
JavaScript
x
class a {
function test() { }
}
class b extends a {
function test() { }
}
and the result matches must be
JavaScript
class a {
function test() { }
}
and
JavaScript
class b extends a {
function test() { }
}
Advertisement
Answer
regexps are poor at parsing programming languages’ grammars. Consider tokenizer functions instead. e.g. http://php.net/manual/en/function.token-get-all.php see also this http://framework.zend.com/apidoc/core/Zend_Reflection/Zend_Reflection_File.html