Public/Get-NSPLogPattern.ps1
|
function Get-NSPLogPattern { [CmdletBinding()] param([Parameter(Mandatory)][ValidateSet('KeyValuePair', 'RobocopyPathTooLong', 'RichCopyRecord')][string]$Name) switch ($Name) { # Captures quoted values with spaces, unquoted values, and empty strings. KeyValuePair { return '(?<Key>[^\s=]+)=(?:"(?<Value>[^"]*)"|(?<Value>[^\s]+))' } RobocopyPathTooLong { return '(?m)^\d{4}/\d{2}/\d{2}\s+\d{2}:\d{2}:\d{2}\s+ERROR 206\s+\(0x000000CE\)\s+Scanning Source Directory\s+(?<Path>[^\r\n]+)\r?\nThe filename or extension is too long\.' } RichCopyRecord { return '^(?<Date>\d{1,2}/\d{1,2}/\d{2,4})\s+(?<Time>\d{1,2}:\d{2}:\d{2}\s+(?:AM|PM)),(?<Code>[^,]*),(?<Operation>.*)$' } } } |