views:

53

answers:

3

I want to build a regex that matches PHP-style error messages in HTML source code.

Does anybody know of one that exists or how I can create a list of possible PHP error outputs?

+1  A: 

Take a look at the PHP source code, there should be a function to wrap errors and try to guess the convention used for all errors, warning, notices messages.

Boris Guéry
A: 

You can see a list of PHP's Predefined Constants.

Every error/warning/notice will fall into one of these categories, however there are likely hundreds if not thousands of possible messages which PHP can throw.

evolve
+1  A: 

Depending on what you're actually trying to accomplish (you weren't very specific), I would instead recommend using set_error_handler.

function myErrorHandler($errno, $errstr, $errfile, $errline) {
  // handle and log the error appropriately
}

set_error_handler("myErrorHandler");
Aistina
Seriously, if I say I want to match PHP-style error messages, this is not what I want to do ;)I hope my comment above explains better...
Franz
@Franz: Okay, now I know why you want to do this :) If you had included that information in the question right away, I wouldn't have posted this answer ;)
Aistina