diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-07 11:46:04 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-07 11:46:04 +1300 |
commit | 83382e14d92cadaa40c62d07cdba05a6ded5af83 (patch) | |
tree | d1dc686b9fe272ade46654124f6a81b06a8fd810 /src/org/traccar/helper/PatternBuilder.java | |
parent | ea7d1c6268359221191d78bcbf0d65d2dcb06088 (diff) | |
download | trackermap-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.java | 10 |
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) { |