Menu

#4 Incorrect parsing of multiple string switches

open
nobody
None
5
2007-12-01
2007-12-01
Anonymous
No

When trying to parse

app.exe -a "aaa" -b "bbb"

the value of switch a becomes

aaa" -b "bbb

This is caused by an incorrect regex in the function initialise in class StringSwitch. The line

this.valuePattern = @")((?:"")(?<value>.+)(?:"")|(?<value>\S+))";

should be replaced with

this.valuePattern = @")((?:"")(?<value>[^""]+)(?:"")|(?<value>\S+))";

EJ

Discussion


Log in to post a comment.