A fairly simple question that I hope for.
I have a text log file that includes the following line:
123.010502500114082000000009260000000122001T
I want to search the log file and return the "00000000926" section of the above text. Therefore, I wrote a regular expression: (& L;?. = 123 {17}). {eleven}
So, when the appearance of the text is β123β with 17 characters, return the next 11. This works great when testing in online regular expression editors. However, in Powershell, the entire string is returned instead of the 11 characters that I want, and I cannot understand why.
$InputFile = get-content logfile.log $regex = '(?<=123.{17}).{11}' $Inputfile | select-string $regex
(the whole string is returned).
Why does powershell return the entire string?
source share