rastoboy has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a simple text search CGI script. The user types in a search term, and I perl grep through a datastructure of the text and return data.
At the moment I untaint the user input by allowing only "word like" characters and such. However, I'd like to allow the users to use regular expressions in their searches. However, I am not enough of a regex master to know what to allow/disallow. I've been told that you can execute code in a regex, so that makes me nervous about accepting any regex.
Is there a tool or any hints as to how I could safely allow this? Any input would be greatly appreciated!
rasto
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: untainting regex input
by kennethk (Abbot) on Aug 23, 2013 at 02:38 UTC | |
|
Re: untainting regex input
by zork42 (Monk) on Aug 23, 2013 at 05:57 UTC | |
|
Re: untainting regex input
by Anonymous Monk on Aug 23, 2013 at 07:21 UTC |