Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Dan1el42/7b03afaca598baafbc4cb2b1d6825ba7 to your computer and use it in GitHub Desktop.
Save Dan1el42/7b03afaca598baafbc4cb2b1d6825ba7 to your computer and use it in GitHub Desktop.
# Option 1: Access the capture group (\d+) by number.
if ($Event[0].Message -match 'sequence number (\d+)')
{
$Number = $Matches[1]
}
# Option 2: Access the number using the named capture group "Number"
if ($Event[0].Message -match 'sequence number (?<Number>\d+)')
{
$Number = $Matches.Number
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment