in reply to Re: Comparing two variables when one variable includes a regexp...
in thread Comparing two variables when one variable includes a regexp...
Surely all these replies that fix one example out of an infinite number of possible user inputs are missing the point?
If I understood the original post, $NetPattern is to be read from the command line, so the example, mistaken bracketing and all, was just an example. The question was
If a user enters a command-line regular expression that gets pushed into a variable, what is the most reliable way to use that variable to compare it against another variable that is a string?
In our answers, we should be explaining how to validate a user-supplied string before interpolating it into a regex. A simple error like [ without matching ] is the least of our worries.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Comparing two variables when one variable includes a regexp...
by jettero (Monsignor) on May 01, 2008 at 19:24 UTC |