Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Reg Exp to handle variations in the matched patternby markjrouse (Initiate) |
on Feb 22, 2012 at 13:04 UTC ( [id://955515]=perlquestion: print w/replies, xml ) | Need Help?? |
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.
Back to
Seekers of Perl Wisdom
|
|