Skip to content

Commit

Permalink
Updated regex in profile parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccremer committed Feb 12, 2018
1 parent b2810ea commit e55dac3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
class ProfileParserImpl implements ProfileParser {

public static final Pattern FORMAT_PATTERN = Pattern.compile("%\\{([a-zA-Z]+)=(.*)\\}");
private static final Pattern WHITESPACE_PATTERN = Pattern.compile("([^\"]\\S*|\".+?\")\\s*");
// (\S*?"[^"]*"|[^" ]+)\s??
private static final Pattern WHITESPACE_PATTERN = Pattern.compile("(\\S*?\"[^\"]*\"|[^\" ]+)\\s??");

@Override
public Optional<Profile> parseFile(Path path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void separateWhitespace_ShouldReturnOneElement_IfNoWhitespace() throws Ex
public void separateWhitespace_ShouldReturnOneElement_IfWhitespaceIsQuoted() throws Exception {
String testLine = "\"one two \"";
assertThat(subject.separateWhitespace(testLine))
.contains("one two ", atIndex(0))
.contains("\"one two \"", atIndex(0))
.hasSize(1);
}

Expand Down

0 comments on commit e55dac3

Please sign in to comment.