Skip to content

Instantly share code, notes, and snippets.

@DBremen
Created February 8, 2021 16:28
Show Gist options
  • Save DBremen/a8882ebd808feea20f32bdb581f11cdd to your computer and use it in GitHub Desktop.
Save DBremen/a8882ebd808feea20f32bdb581f11cdd to your computer and use it in GitHub Desktop.
PowerShell example to extract text between delimiters using RegEx
$testText = 'Peter <[email protected]>, Paul <[email protected]>, Zoe <[email protected]>'
$pattern = '(?<=\<).+?(?=\>)'
[regex]::Matches($testText, $pattern).Value
<#
output
[email protected]
[email protected]
[email protected]
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment