Mar-05-2023, 05:43 AM
Greetings to those that do not sleep!
Could anyone explain why the hell regex is not working?
I used "^\s+" because of the multiple spaces before the " Visual ID:"
Then "\s+" for spaces after the " Visual ID:"
Then "Z[A-Z0-9]{12}" to match the visual ID number
And the "\s+$" to match the spaces at the end of the visual number.
seems right but it is not....
Any help is appreciated! Thank you!
I'm trying to get the line that goes like this: Visual ID: Z2BB417600504 <--- Need to get this line But it also could be found like this: Visual ID: Z2BB417600504 or like this : Some lines from the file Visual ID: Z2BB417600504 and also Another line Visual ID: Z2BB417600504 from the same fileRegex I constructed does not work for some reason.
re.search("^\s+Visual ID:\s+Z[A-Z0-9]{12}\s+$",line)
Could anyone explain why the hell regex is not working?
I used "^\s+" because of the multiple spaces before the " Visual ID:"
Then "\s+" for spaces after the " Visual ID:"
Then "Z[A-Z0-9]{12}" to match the visual ID number
And the "\s+$" to match the spaces at the end of the visual number.
seems right but it is not....
Any help is appreciated! Thank you!