isRegExp to use php last error?
Closed this issue · 0 comments
hoshsadiq commented
I saw that isRegExp
is not implemented yet. I have once before needed to know during run time whether or not a string is a regular expression string or not, and after a lot of research, I failed quite epicly. So I turned to stackoverflow where user ThiefMaster gave me some code that works:
ini_set('track_errors', 'on');
$php_errormsg = '';
@preg_match('/[blah/', '');
if($php_errormsg) echo 'regex is invalid';
Which works. Maybe this can be implemented as isRegExp
? I'm not sure if it's a good idea though, hence why I'm asking.
Alternatively, maybe interoperability with a library like Flux?