With Regular Expressions I\'m trying to remove all the methods/functions from the following code. Leaving the \"global scope\" alone. However, I can\'t manage to make it mat
I believe using PHP's built-in Tokenizer feature or Zend_CodeGenerator from Zend Framework is a more safe way. These will also keep your code more readble.
This is just because if you want use regexp to parse source codes, you must maintain your own tokens set but there is a built-in solution.