No such thing as a small change | |
PerlMonks |
Re^2: Match all Non-0 and Lettersby arblargan (Acolyte) |
on Jun 24, 2017 at 22:08 UTC ( [id://1193465]=note: print w/replies, xml ) | Need Help?? |
All, thank you very much for the help. My apologies with the confusing post as I typed this out before bed last night in desperation. The word extraction happens farther up in the subroutine than I've shown, but by the time it gets to this point, it will always be 8 continuous digits (or letters if there's corruption) not separated by whitespace. I realize that using the $D1 and $D2 variables makes the regex much more difficult than it needed to be, but I created those to try and figure out where the regex was failing at. When I tried my initial regex it looked something like this if ($Disc =~ /[1-9a-zA-Z]{7}\D/) However, this still did not perform the functions that I was wanting. I did try something similar to if ($Disc !~ /0{7}\d/) but I think I may have used a D by mistake. I just tried if ($Disc !~ /(0{7})(\d$)/) and the regex worked great! Thank you all for the quick replies and showing the correct syntax for what I'm trying to do. As I mentioned before, I'm relatively new to Perl, so I still have quite a ways to go, especially with the regex syntax.
In Section
Seekers of Perl Wisdom
|
|