I need to check a string to see if it conatins anything other than spaces, returns, etc.
In perl, I used:
if($val =~/^\s*$/) {...}
How do I do that in PowerShell?
Use the -match
operator:
if ($test -match 'regex_here') { 'It matched' }
Also check the online docs for comparison operators: http://technet.microsoft.com/en-us/library/hh847759.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With