diff options
-rw-r--r-- | src/org/traccar/helper/PatternBuilder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/helper/PatternBuilderTest.java | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/org/traccar/helper/PatternBuilder.java b/src/org/traccar/helper/PatternBuilder.java index 6742e7130..3a8bdd868 100644 --- a/src/org/traccar/helper/PatternBuilder.java +++ b/src/org/traccar/helper/PatternBuilder.java @@ -48,7 +48,7 @@ public class PatternBuilder { s = s.replace("dddd", "d{4}").replace("ddd", "d{3}").replace("dd", "d{2}"); s = s.replace("xxxx", "x{4}").replace("xxx", "x{3}").replace("xx", "x{2}"); - s = s.replace("d", "\\d").replace("x", "\\p{XDigit}").replaceAll("([\\.])", "\\\\$1"); + s = s.replace("d", "\\d").replace("x", "[0-9a-fA-F]").replaceAll("([\\.])", "\\\\$1"); s = s.replaceAll("\\|$", "\\\\|").replaceAll("^\\|", "\\\\|"); // special case for delimiter fragments.add(s); diff --git a/test/org/traccar/helper/PatternBuilderTest.java b/test/org/traccar/helper/PatternBuilderTest.java index 36054bcea..975cc1621 100644 --- a/test/org/traccar/helper/PatternBuilderTest.java +++ b/test/org/traccar/helper/PatternBuilderTest.java @@ -8,7 +8,7 @@ public class PatternBuilderTest { @Test public void testPatternBuilder() { Assert.assertEquals("\\$GPRMC", new PatternBuilder().text("$GPRMC").toString()); - Assert.assertEquals("(\\d{2}\\.\\p{XDigit}+)", new PatternBuilder().number("(dd.x+)").toString()); + Assert.assertEquals("(\\d{2}\\.[0-9a-fA-F]+)", new PatternBuilder().number("(dd.x+)").toString()); Assert.assertEquals("a(?:bc)?", new PatternBuilder().text("a").text("b").text("c").optional(2).toString()); Assert.assertEquals("a|b", new PatternBuilder().expression("a|b").toString()); Assert.assertEquals("ab\\|", new PatternBuilder().expression("ab|").toString()); |