Get-RegexTest.ps1

by Dec 22, 2008

# Get-RegexTest.ps1   # Sample Using PowerShell   # Thomas Lee – tfl@psp.co.uk     # Define a regular expression for currency values.   $rx = New-Object system.text.RegularExpressions.Regex "^-?d+(.d{2})?$"     # Define tests   $tests = "-42" , "19.99" , "0.001" , "100 USD" , ".34" , "0.34" , "1,052.21" , "Jerry Garcia"     # Now test and report   foreach ( $test   in   $tests )  {  if ( $rx .IsMatch… Read the full text.