Title |
Test
Find
Pattern Title
|
Expression |
(?<=[-{1,2}|/])(?<name>[a-zA-Z0-9]*)[ |:|"]*(?<value>[\w|.|?|=|&|+| |:|/|\\]*)(?=[ |"]|$) |
Description |
Parses command line strings into name value pairs |
Matches |
-path:c:\test path\temp -param "spaced string" -x |
Non-Matches |
"this is a non matched string" |
Author |
Rating:
Gavin Hay
|
Source |
|
Your Rating |
|
Title: param 1 or 2 doesn't works
Name: Anon
Date: 10/20/2011 10:33:38 AM
Comment:
this command lines doesn't works:
consoleaplication -param 1
consoleaplication -param 2
but
consoleaplication -param 3 <- it works
Example:
Dim col As RegularExpressions.MatchCollection = Regex.Matches(argStr, _
"(?<=[-{1,2}/])(?<name>[a-zA-Z0-9]*)[ |:|""]*(?<value>[\w|.|?|=|&|+| |:|/|\\]*)(?=[ |""]|$)", RegexOptions.IgnoreCase Or RegexOptions.Multiline)
col.Count = 2 <- if params are: -h 1 or -h 2
but
col.Counts = 1 <- if params are: -h 3
why?
reply to: [email protected]