I have written the regex, it was working.
Now requirement has become lil complex,
I have a text file, from this text file i want to extract one digit/numberic value.
Cases
This digit is present
2.some times not present
3.some times goes to next line
Here is the screenshot
So this number 3 can be in the same place , or it may not be there, Or it may go to next line…
and the things marked in Yellow color boxes are always fixed lines
You need to consider I built this expression doing the following assuptions:
The number you are looking for, it’s always preceded by a number 6 followed by a period, one or more blank spaces, then a some under scores then any space, whitespace or new line.
If the number is not there, there won’t be matches.
(?:6.\s*_ \s ) When a group starts with ?: it means the group it’s not going to be captured for the final result, but it has to be present there. Then the number 6, followed by a period. Then any whitespace, then any underscore and finally any whitspace.
(\d) Then one single digit.
(. |\s ) Any character or any whitespace.
(?:_ *) Other non capturing group of any underscore.