aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/PatternBuilder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/helper/PatternBuilder.java')
-rw-r--r--src/org/traccar/helper/PatternBuilder.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/helper/PatternBuilder.java b/src/org/traccar/helper/PatternBuilder.java
index 5d9d3afa8..4ce4295dd 100644
--- a/src/org/traccar/helper/PatternBuilder.java
+++ b/src/org/traccar/helper/PatternBuilder.java
@@ -33,6 +33,8 @@ public class PatternBuilder {
}
public PatternBuilder expression(String s) {
+ s = s.replaceAll("\\|$", "\\\\|"); // special case for delimiter
+
fragments.add(s);
return this;
}
@@ -63,6 +65,11 @@ public class PatternBuilder {
return this;
}
+ public PatternBuilder or() {
+ fragments.add("|");
+ return this;
+ }
+
public PatternBuilder groupBegin() {
return expression("(?:");
}
@@ -75,10 +82,6 @@ public class PatternBuilder {
return expression(")" + s);
}
- public PatternBuilder or() {
- return expression("|");
- }
-
public Pattern compile() {
return Pattern.compile(toString(), Pattern.DOTALL);
}