Skip to content

Commit 2623899

Browse files
committed
fix matching string escapes in literals as per spec
https://www.w3.org/TR/n-quads/#grammar-production-STRING_LITERAL_QUOTE
1 parent d631643 commit 2623899

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/JsonLD/Core/RDFDatasetUtils.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,9 @@ private class Regex
553553
public static readonly Pattern Bnode = Pattern.Compile("(_:(?:[A-Za-z0-9](?:[A-Za-z0-9\\-\\.]*[A-Za-z0-9])?))"
554554
);
555555

556-
public static readonly Pattern Plain = Pattern.Compile("\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\""
557-
);
556+
public static readonly Pattern ECHAR = Pattern.Compile("\\\\[tbnrf\"'\\\\]");
557+
558+
public static readonly Pattern Plain = Pattern.Compile("\"((?:[^\\x22\\x5C\\x0A\\x0D]|" + ECHAR + "|" + UCHAR + ")*)\"");
558559

559560
public static readonly Pattern Datatype = Pattern.Compile("(?:\\^\\^" + Iri + ")"
560561
);

0 commit comments

Comments
 (0)