How to capture a lines with fixed length fields including specified characters and a substrings? In this case:
- each fields contain 8 characters
- the first filed includes only 'RBE3' and whitespaces
- the third filed includes only '123' and whitespaces
input:
123456781234567812345678123... (char numbers)
RBE3 323123 123121
RBE3 323123 123 121
RBE3 32312300123 121
RBE3 3231231234 121
$ RBE3 323123123 121
R B E3 32312 123 121
RBE32312 12313
output would be:
RBE3 323123 123121
RBE3 323123 123 121
RBE3 32312300123 121
I tried with:
regex = r'^([RBE3\s]{8}.{8}[123\s]{8}.*\n)'
but it seems a completely wrong direction