|
Complex Regular Expression HELP
Condition:
Print error message if 5 consecutive zeros are found in front or back of a chunk of 5 integers >=50.
Numbers are counted in a chunk of 5
Example
000000005000000000210005200000000250000000056
Lets put commas in between chunks of five to make the problem simpler
00000,00050,00000,00021,00052,00000,00025,00000,00 056
There is 5 consecutive zero in front of 00050 - Println"error" (condition met 00000 in front and 00050>=50)
There is 5 consecutive zeros back of 00050- print error(condition met 00000 in back and 00050>=50)
Even though there is 5 consecutive zeros in front of 00021 it does not count (condition failed because that chunk of zero is already associated with 00050 and also 00021 is not >=50 )
There is 5 consecutive zero back of 00052- print error (Condition met 00000 in the back and 00052 is >=50)
00000,00050,00000,00021,00052,00000,00025,00000,00 056
Even though there is 5 consecutive zeros in front and back of 00025 it does not matter (condition failed because 00025 in not >=50 and also that front chunk of zero was already associated with 00052)
There is 5 consecutive zeros in front of 00056 - print error (condition met because there is 00000 in front of 00056 and 00056>=50 and that chunk of zero was not associated with 00025 because 00025 was not >=50)
I hope this explains a little bit more clearely.
A regular expression would help or any logic will be appreciated.
|