2013-05-03 55 views

回答

9

使用-match操作:

if ($test -match 'regex_here') { 'It matched' } 

同时检查在线文档进行比较运算符:http://technet.microsoft.com/en-us/library/hh847759.aspx

+0

我发现http://ss64.com/ps/syntax-regex.html会有所帮助。它看起来像我想要的是,$ string -match“\ s +” – Jeff 2013-05-03 21:17:08

+2

Jeff,另一个技巧是'$ val.Trim().length'。这将删除所有前导/尾随空白字符。如果只有这一切,“长度”将为0。 – 2013-05-03 21:21:53

-1

如果( “〜/^\ s * $ /” ToCharArray() - 包含$ VAL。 ){“...”}

相关问题