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 <peter@gmail.com>, Paul <paul@gmail.com>, Zoe <zoe@gmx.com>'
$pattern = '(?<=\<).+?(?=\>)'
[regex]::Matches($testText, $pattern).Value
<#
output
peter@gmail.com
paul@gmail.com
zoe@gmx.com
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment