I have a regex query working in regexr but it will not work for me in PowerShell. What am I doing wrong?
regex
(Host.*[\r\n]+([^\r\n]*)+[\r\n]+([^\r\n]*))
Data
HostName: ComputerName Date: 2018-12-21 Time: 09:16:02 Step: 01 Date: 2018-12-21 Time: 09:29:18 Step: 02 Date: 2018-12-21 Time: 09:47:38 Step: 03 Date: 2018-12-21 Time: 10:08:43 Step: 04 Date: 2018-12-21 Time: 10:27:00 Step: 05 Date: 2018-12-21 Time: 10:45:14 Step: 06 Date: 2018-12-26 Time: 10:02:39
On match it captures the rest of the line and the next two lines. Since everything is in groups of 3 per entry in the log.
I pasted the working code in powershell and attempted the three ways.
$data | select-string -match "(Host.*[\r\n]+([^\r\n]*)+[\r\n]+([^\r\n]*))"
$data -matches "(Host.*[\r\n]+([^\r\n]*)+[\r\n]+([^\r\n]*))"
I've done research and the closest thing I can get is that windows doesn't play nice with \r\n.
I haven't found a solution yet.
What am I doing wrong or what do I need to replace \r\n with?
$data.GetType().FullName?