The class BESRegex::match() method has an non-intuitive behavior that has made it get used in ways that I think have serious unintended consequences.
BESRegex::match() returns the number of characters that match, -1 if there's no match.
And that is a problem because in practice (and I looked at) the code that utilizes this method looks like this:
And that is really bad because when nothing matches the -1 returned evaluates as true.
This ticket is to fix the behavior of the method, and review every point of use to make sure things work as expected.