I am trying to identify errors in a log file. The application uses five uppercase letters followed by three digits followed by 'E' as an error code. The error code is followed by a non-word character. I was identifying cases with:
$errors=Select-string -Path "logfile.txt" -Pattern "[A-Z]{5}[0-9]{3}E\W"
However the remainder of the content now includes
ab1bea8a-a00e-4211-b1db-2facecfd725e.
Which is being matched by the regex and flagged as an error. I changed the regex to
\p{Lu}{5}[0-9]{3}E\W
(which I expected to match five upper case characters), but why does it still match the non-error lower case pattern?
\p{Lu}insensitive to the outer regex settings by placing it into a modifier group like(?-i:\p{Lu}{5}[0-9]{3}E\W)