Skip to content

Commit 27d4c66

Browse files
committed
Use possessive quantifiers in string identification regexes.
1 parent 8e5bd61 commit 27d4c66

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/edu/washington/cs/knowitall/logic/LogicExpressionParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public LogicExpression<E> apply(String string) {
4545
public abstract Arg<E> factory(String argument);
4646

4747
public final static Pattern doubleQuoteStringLiteralRegex =
48-
Pattern.compile("\"" + "((?:[^\"\\p{Cntrl}\\\\]|\\\\[\\\\'\"bfnrt]|\\\\u[a-fA-F0-9]{4})*)" + "\"");
48+
Pattern.compile("\"" + "([^\"\\p{Cntrl}\\\\]*+(?:\\\\[\\\\'\"bfnrt])*+(?:\\\\u[a-fA-F0-9]{4})*+)*+" + "\"");
4949
public final static Pattern singleQuoteStringLiteralRegex =
50-
Pattern.compile("'" + "([^']*)" + "'");
50+
Pattern.compile("'" + "(?:[^']*+)" + "'");
5151
public final static Pattern regexLiteralRegex =
52-
Pattern.compile("/" + "((?:[^/\\\\]*(?:\\\\)*(?:\\\\/)*)*)" + "/");
52+
Pattern.compile("/" + "(?:(?:[^/\\\\]*+(?:\\\\)*+(?:\\\\/)*+)*+)" + "/");
5353
private final static List<Pattern> literalPatterns = Lists.newArrayList(
5454
doubleQuoteStringLiteralRegex, singleQuoteStringLiteralRegex,
5555
regexLiteralRegex);

0 commit comments

Comments
 (0)