|Welcome to the Monastery|
Match all Non-0 and Lettersby arblargan (Acolyte)
|on Jun 24, 2017 at 07:05 UTC||Need Help??|
arblargan has asked for the wisdom of the Perl Monks concerning the following question:
I'm relatively new to Perl and am having a terribly difficult time figuring this one out. I'm expecting a string in the following format:
Essentially, a normal word will be 7 0's followed by a number between 0-9 (8-digits total). However, occasionally there is corruption in the file being processed, causing the format to have something like the following:
FFFFFFFF or 6C163512
I want to skip these lines of corruption and loop until the corruption has been passed. This is where the tricky part comes in (at least for me). I have tried every combination of matching I can think of, but can't seem to get this one squared away. Below are the lines of code I have tried:
I've been working on this forever and can't seem to figure out how to dynamically catch this corruption in the event that all F's have migrated from the string word. I created the $D1 and $D2 variables to try and see why the regex patterns weren't matching, but I still can't figure it out.
Lastly, it should be noted that occasionally, the line of corruption will show as 01020102. The corruption value will be dynamic. This is why I simply can't use /\D+/ for the majority of the string as the first 7 digits must be 0 for a valid word.