Skip to content

Commit e55dac3

Browse files
committed
Updated regex in profile parser.
1 parent b2810ea commit e55dac3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/java/net/chrigel/clustercode/scan/impl/ProfileParserImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
class ProfileParserImpl implements ProfileParser {
2222

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

2627
@Override
2728
public Optional<Profile> parseFile(Path path) {

src/test/java/net/chrigel/clustercode/scan/impl/ProfileParserImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void separateWhitespace_ShouldReturnOneElement_IfNoWhitespace() throws Ex
159159
public void separateWhitespace_ShouldReturnOneElement_IfWhitespaceIsQuoted() throws Exception {
160160
String testLine = "\"one two \"";
161161
assertThat(subject.separateWhitespace(testLine))
162-
.contains("one two ", atIndex(0))
162+
.contains("\"one two \"", atIndex(0))
163163
.hasSize(1);
164164
}
165165

0 commit comments

Comments
 (0)