Pages

5/25/2011

Top 10 Tips for Using Windows PowerShell - O'Reilly Media

Top 10 Tips for Using Windows PowerShell - O'Reilly Media: "Since .NET includes powerful regular expression capabilities, PowerShell includes a regex type. Just put the word regex in brackets ([]) before a string to create a regular expression. Then you can use the regular expression with the -match operators. Here's an example:

PS C:\> $re = [regex]'abc[123]'
PS C:\> 'abc1' -match $re
True
PS C:\> 'abc4' -match $re
False
PS C:\>"

No comments: