note 114922 added to function.eval
| From: | andrea at donboscoland dot it | Date: | Sun, 27 Apr 2014 15:03:09 +0000 |
| Subject: | note 114922 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199339@lists.php.net to get a copy of this message | ||
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
----
Server IP: 72.52.91.14
Probable Submitter: 194.184.102.210
----
Manual Page -- http://php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/114922
Del: integrated -- https://master.php.net/note/delete/114922/integrated
Del: useless -- https://master.php.net/note/delete/114922/useless
Del: bad code -- https://master.php.net/note/delete/114922/bad+code
Del: spam -- https://master.php.net/note/delete/114922/spam
Del: non-english -- https://master.php.net/note/delete/114922/non-english
Del: in docs -- https://master.php.net/note/delete/114922/in+docs
Del: other reasons-- https://master.php.net/note/delete/114922
Reject -- https://master.php.net/note/reject/114922
Search -- https://master.php.net/manage/user-notes.php