PowerShell
$matches = [regex]::match(' one two three ', '((\w+) +(\w+) +(\w+))')
"Matched string starts at position $($matches.Index) and has $($matches.Length) characters"
" 1st group: $($matches.Groups[2].value)"
" 2nd group: $($matches.Groups[3].value)"
" 3rd group: $($matches.Groups[4].value)"
#
# Matched string starts at position 2 and has 13 characters
# 1st group: one
# 2nd group: two
# 3rd group: three
Poor man's attempt at finding SQL table names in an SQL file
[string] $file = [IO.File]::ReadAllText('c:\users\rene\x.sql')
$re = [regex] '(?ism)(from|join)\s+(\S+)'
$tables = [regex]::Matches($file, $re)
foreach ($table in $tables) {
"$($table.groups[2].value)"
}