markjrouse has asked for the wisdom of the Perl Monks concerning the following question:
How can I search for a specific string pattern that has variations on the matches to that pattern?. I'm trying to find two regexp patterns:
So I use (\s-\r)|(:\r) This works, but its pattern 2 that matches different variations. As an example, in my text file, I can have different pattern 2 cases like this:
What I'm looking for is to perhaps modify my reg exp in such a way that pattern 2 only matches match2a. I want to exclude the match2b/c matches. I thought along the lines of:
(\s-\r)|(:\r)([^:\r(\d|\w]))But of course this doesn't work. Any suggestions.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reg Exp to handle variations in the matched pattern
by moritz (Cardinal) on Feb 22, 2012 at 13:12 UTC | |
by markjrouse (Initiate) on Feb 22, 2012 at 13:23 UTC | |
by moritz (Cardinal) on Feb 22, 2012 at 14:19 UTC | |
by markjrouse (Initiate) on Feb 22, 2012 at 16:32 UTC | |
by bitingduck (Deacon) on Feb 23, 2012 at 06:33 UTC | |
| |
by markjrouse (Initiate) on Feb 22, 2012 at 17:02 UTC | |
|
Re: Reg Exp to handle variations in the matched pattern
by bitingduck (Deacon) on Feb 22, 2012 at 15:46 UTC |