Skip to content

Commit 10fbf28

Browse files
committed
Modified the command string regular expression to properly parse quoted values containing periods. Corrected a typo in the test for the same.
1 parent 0aef1a9 commit 10fbf28

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Utility.CommandLine.Arguments.Tests/Arguments.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public void ParseStringOfLongs()
331331
[Fact]
332332
public void ParseValueWithQuotedPeriod()
333333
{
334-
Dictionary<string, string> test = CommandLine.Arguments.Parse("--test \"test.test\" --test2 'test2.test2.'").ArgumentDictionary;
334+
Dictionary<string, string> test = CommandLine.Arguments.Parse("--test \"test.test\" --test2 'test2.test2'").ArgumentDictionary;
335335

336336
Assert.Equal("test.test", test["test"]);
337337
Assert.Equal("test2.test2", test["test2"]);

Utility.CommandLine.Arguments/Arguments.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public class Arguments
130130
/// <summary>
131131
/// The regular expression with which to parse the command line string.
132132
/// </summary>
133-
private const string ArgumentRegEx = "(?:[-]{1,2}|\\/)([\\w-]+)[=|:| ]?(\\w\\S*|\\\"[^\".]*\\\"|\\\'[^'.]*\\\')?|([^- ([^'\\\"]+|\"[^\\\"]+\"|\\\'[^']+\\\')";
133+
private const string ArgumentRegEx = "(?:[-]{1,2}|\\/)([\\w-]+)[=|:| ]?(\\w\\S*|\\\"[^\"]*\\\"|\\\'[^']*\\\')?|([^- ([^'\\\"]+|\"[^\\\"]+\"|\\\'[^']+\\\')";
134134

135135
/// <summary>
136136
/// The regular expression with which to parse argument-value groups.

0 commit comments

Comments
 (0)