Ben Win Lue has asked for the wisdom of the Perl Monks concerning the following question:
I have a nine character string that contains three columns of 3 characters and I have to find two strings in the string.
Ok, lets say I have to find 'abc' and 'xyz'
'abcmmmnnn' has to result true (abc is found in first column)
'mmmxyznnn' has to result true (xyz is found in second column)
'mabcmxyzm' has to result false (neigther abc nor xyz in the columns)
I can do it the easy way by splitting the string into substrings and doing 6 single eq or doing 2 greps in an array of the substrings.
But is there a cool regex way?
Thank you for your attention
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cool regular expression needed for matching in columns
by davorg (Chancellor) on Jan 24, 2007 at 10:09 UTC | |
|
Re: cool regular expression needed for matching in columns
by shmem (Chancellor) on Jan 24, 2007 at 10:22 UTC | |
|
Re: cool regular expression needed for matching in columns
by caelifer (Scribe) on Jan 24, 2007 at 16:37 UTC | |
|
Re: cool regular expression needed for matching in columns
by graff (Chancellor) on Jan 25, 2007 at 05:12 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |