Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
this looks like a problem that should be easily solved with a regular expression, but i'm stuck :-( given a variable that might look like this:
$x='see the 9 brown foxes. they are certainly fast.';
the string is two sentences. '9' may not always be 9...but 8 or 7 or...but always a number. and the same goes for 'certainly' -- it could be any word.
certainly, something could be written that looks at $x enough times to have a sufficient degree of confidence that there is a string match. (eg, match on 'see the ' and then match on 'brown foxes' and match ong 'they certainly') but there is no elegance and little efficiency in that method.
is there a better way? - d
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: searching a string with variable data
by borisz (Canon) on Nov 29, 2004 at 23:40 UTC | |
by ikegami (Patriarch) on Nov 29, 2004 at 23:47 UTC | |
by chb (Deacon) on Nov 30, 2004 at 07:14 UTC | |
|
Re: searching a string with variable data
by rupesh (Hermit) on Nov 30, 2004 at 03:28 UTC |