Input string:
1234 5678 9101 1234
2999 5178 9101 2234
9999 5628 9201 1232
8888 3678 9101 1232
The input string above has spaces after 1st, 2nd and 3rd line. Each line after the last digit has spaces and then the new line starts except the last line.
The last line ends at the last character(digit '2') and has nothing else after that.
Required Match: I want to match only the first three block of digits in each line(match should not include the single space between blocks).
Expected Output using sed:
**** **** **** 1234
**** **** **** 2234
**** **** **** 1232
**** **** **** 1232
My approach: I use negative lookbehind(I know that sed does not support lookaround assertions) \d{4}(?! {2,})
that matches, in first three lines, only the first three block of digits but in the fourth line matches all the blocks of digits(obviously as the last line does not have 2 spaces after the last digit.)
Fiddle: https://regex101.com/r/VzQf3D/2