[pmwiki-devel] Math pattern matching glitch

Patrick R. Michaud pmichaud at pobox.com
Tue Mar 20 13:17:12 CDT 2007


On Tue, Mar 20, 2007 at 02:11:03PM -0400, The Editor wrote:
> Also, I still can't seem to get this pattern to match properly...
> 
> $ZAPmath = "/^[-+*/% ()0-9.]+$/";
> if (! preg_match($ZAPmath, $value)) $m .= "Invalid numeric input. ";
> 
> It returns very unpredictable results.  Can't seem to get it right...

You might need to escape the slash that occurs in the middle,
or use some character other than slashes as the delimiter:

    "/^[-+*\\/% ()0-9.]+$/"

    "!^[-+*/% ()0-9.]+$!"

Pm



More information about the pmwiki-devel mailing list