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.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/org/traccar/helper/PatternBuilder.java b/src/org/traccar/helper/PatternBuilder.java
index e8f5c605a..0105bf7a6 100644
--- a/src/org/traccar/helper/PatternBuilder.java
+++ b/src/org/traccar/helper/PatternBuilder.java
@@ -21,6 +21,10 @@ public class PatternBuilder {
private final StringBuilder pattern = new StringBuilder();
+ public interface Builder {
+ void build(PatternBuilder builder);
+ }
+
public PatternBuilder xpr(String s) {
pattern.append(s);
return this;
@@ -60,6 +64,14 @@ public class PatternBuilder {
return not(s).txt(s);
}
+ public PatternBuilder groupBegin() {
+ return xpr("(?:");
+ }
+
+ public PatternBuilder groupEnd(boolean optional) {
+ return xpr(optional ? ")?" : ")");
+ }
+
public Pattern compile() {
return Pattern.compile(pattern.toString(), Pattern.DOTALL);
}