You might use Regexp::English /PPIx::Regexp / Regexp::Debugger, see links and content in Re: Wanted: Perl Regex Pretty Printer (almost, rxrx, rxplain)
Reject anything with errors, remove code nodes, escape literals ... insert callback/for recursion/backtracking/ abortion
Or allow only limited subset to be built ... insert callback for recursion /backtracking detection/abortion
In reply to Re: untainting regex input
by Anonymous Monk
in thread untainting regex input
by rastoboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |