I'm currently working on a small framework type of project. In this project a eval() is needed. This eval string is not user-submitted, but i would still like to validate that the string is a (contains a) variable.
The types of variable could be both normal variables, class properties and superglobal variables. I'm new to regex so I would appreciate any help.
Just to clarify: the string would be this as an example contain something like this '$_GET["something"]'.
$_GET["something"]is not "eval-safe", for example,$_GET["${`format c:`}"].eval()is needed." – I'd take some time to seriously reconsider its necessity. Iseval()really (really, really, really) needed? Sharing more about the problem being "solved" byeval()might lead to more suitable alternatives.eval, but in many cases, that's not undoable. A lot of scripting languages seem to regret theeval. It is easy to do a call to the interpreter; but it is opening the box of pandora.