aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/PatternBuilder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-07 11:46:04 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-07 11:46:04 +1300
commit83382e14d92cadaa40c62d07cdba05a6ded5af83 (patch)
treed1dc686b9fe272ade46654124f6a81b06a8fd810 /src/org/traccar/helper/PatternBuilder.java
parentea7d1c6268359221191d78bcbf0d65d2dcb06088 (diff)
downloadtrackermap-server-83382e14d92cadaa40c62d07cdba05a6ded5af83.tar.gz
trackermap-server-83382e14d92cadaa40c62d07cdba05a6ded5af83.tar.bz2
trackermap-server-83382e14d92cadaa40c62d07cdba05a6ded5af83.zip
Use pattern builder for Xexun
Diffstat (limited to 'src/org/traccar/helper/PatternBuilder.java')
-rw-r--r--src/org/traccar/helper/PatternBuilder.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/helper/PatternBuilder.java b/src/org/traccar/helper/PatternBuilder.java
index 7d307668d..c52d3bf63 100644
--- a/src/org/traccar/helper/PatternBuilder.java
+++ b/src/org/traccar/helper/PatternBuilder.java
@@ -28,6 +28,10 @@ public class PatternBuilder {
return this;
}
+ public PatternBuilder opx(String s) {
+ return xpr("(?:").xpr(s).xpr(")?");
+ }
+
public PatternBuilder txt(String s) {
pattern.append(s.replaceAll("([\\\\\\.\\[\\{\\(\\*\\+\\?\\^\\$\\|])", "\\\\$1"));
return this;
@@ -42,13 +46,17 @@ public class PatternBuilder {
return this;
}
+ public PatternBuilder opn(String s) {
+ return xpr("(?:").num(s).xpr(")?");
+ }
+
public PatternBuilder any() {
pattern.append(".*");
return this;
}
public PatternBuilder not(String s) {
- return xpr("[^").txt(s).xpr("]+");
+ return xpr("[^").txt(s).xpr("]*");
}
public PatternBuilder nxt(String s) {