I am newbie in writing scripts in powershell, and even more in regular expressions, please help with the implementation.
example:
PS > .\test.ps1 "A Balrog is a powerful fictional monster in Middle-earth."
return: Middle-earth
or
PS >.\test.ps1 "The symbol underscore, also called low_line or low dash."
return: low_line
of course I tried to find a solution for this problem, here is my solution:
#$data = $args[0]
$p = '\w*[-_]\w*'
Select-String -Path .\content.txt -Pattern $p | % {$_ -match $p; $matches.Value}
Write-Output $matches
=========================================== Update: Solution found