We don't bite newbies here... much | |
PerlMonks |
Re^5: Variable matching on a regexby Marshall (Canon) |
on Jun 17, 2010 at 17:17 UTC ( [id://845250]=note: print w/replies, xml ) | Need Help?? |
I'm not sure that I understand all the questions. It appears to me that
you've asked a couple. This question is bit different than the first one. It is
of consequnce to note that \w characters are "a-zA-Z0-9_", meaning that any \d is
also a \w. Match global is great at repetitive pattern matching! The below shows how to match a "word" followed by some numbers. Enforcing a minimum number of "numbers" after the "word" is easy. The below shows cases where there has to be at least one number or two numbers. The case of enforcing a max is more difficult and I haven't come up with the right syntax. I suppose your intent is that jkl shouldn't appear as there are 5 numbers after that "word", the below shows the first 3 numbers after jkl instead of competely omitting that line as for example xyz was omitted as there aren't any numbers after that "word". I think there is some "look ahead" regex syntax that would solve this problem. But I'm not completely sure that is what you are asking about.
In Section
Seekers of Perl Wisdom
|
|