Matches()
of the System.Text.RegularExpressions.Regex
class returns a System.Text.RegularExpressions.MatchCollection
object. $txt = @' one v_42 two three v_99_xyz four five v_0_abc six. '@ foreach ($m in [regex]::Matches($txt, '\bv_\d+\w*')) { write-host $m.value }