note 114922 deleted from function.eval by googleguy
| From: | googleguy@php.net | Date: | Fri, 24 Feb 2017 21:11:24 +0000 |
| Subject: | note 114922 deleted from function.eval by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208823@lists.php.net to get a copy of this message | ||
Note Submitter: andrea at donboscoland dot it
----
with reference to the problem of mathematic equations validation
, as an operator is not a good idea... i've removed the comma from operators and added the
optional group (,(?1))? to validate functions like pow(2,3)
$operators = '[\/*\^\+-]'; // Allowed math operators
$regexp =
'/^([+-]?('.$number.'|'.$functions.'\s*\((?1)+(,(?1))?\)|\((?1)+\))(?:'.$operators.'(?1))?)+$/';
// Final regexp, heavily using recursive patterns