loris has asked for the wisdom of the Perl Monks concerning the following question:
Hello String-matching Monks,
Here is the problem:
I have string such as
xyz123abcwhich I need to look for in a file. However, the string in the file may contain one or more period characters, e.g.
xyz123abcor
xy.z123abcor
xyz1.23.abcThe only approach that occured to me was to create all the possible strings by inserting periods and then look for the generated strings. This is obviously going to scale badly for long strings.
Can anyone think of a smarter way of addressing the problem?
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching strings differing by a number of periods
by Zaxo (Archbishop) on Oct 18, 2005 at 09:19 UTC | |
|
Re: Matching strings differing by a number of periods
by tirwhan (Abbot) on Oct 18, 2005 at 09:19 UTC | |
|
Re: Matching strings differing by a number of periods
by inman (Curate) on Oct 18, 2005 at 10:15 UTC | |
|
Re: Matching strings differing by a number of periods
by Samy_rio (Vicar) on Oct 18, 2005 at 09:13 UTC | |
|
Re: Matching strings differing by a number of periods
by Moron (Curate) on Oct 18, 2005 at 13:34 UTC |