Question:
I need to check a string to see if it conatins anything other than spaces, returns, etc.
In perl, I used:
1 2 |
if($val =~/^\s*$/) {...} |
How do I do that in PowerShell?
Answer:
Use the -match
operator:
1 2 |
if ($test -match 'regex_here') { 'It matched' } |
Also check the online docs for comparison operators: http://technet.microsoft.com/en-us/library/hh847759.aspx