From fd2fd71a522585ade8653618d95eb0f846f4bfbb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 19 Sep 2016 23:33:42 +1200 Subject: Update regex pattern debugger --- src/org/traccar/helper/PatternUtil.java | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/helper/PatternUtil.java b/src/org/traccar/helper/PatternUtil.java index 88c3f053b..f665eb30d 100644 --- a/src/org/traccar/helper/PatternUtil.java +++ b/src/org/traccar/helper/PatternUtil.java @@ -25,20 +25,13 @@ public final class PatternUtil { } public static class MatchResult { - private String pattern; - private String matched; - private String remaining; + private String patternMatch; + private String patternTail; + private String stringMatch; + private String stringTail; - public String getPattern() { - return this.pattern; - } - - public String getMatched() { - return this.matched; - } - - public String getRemaining() { - return this.remaining; + public String getPatternMatch() { + return patternMatch; } } @@ -50,9 +43,10 @@ public final class PatternUtil { try { Matcher matcher = Pattern.compile("(" + pattern.substring(0, i) + ").*").matcher(input); if (matcher.matches()) { - result.pattern = pattern.substring(0, i); - result.matched = matcher.group(1); - result.remaining = input.substring(matcher.group(1).length()); + result.patternMatch = pattern.substring(0, i); + result.patternTail = pattern.substring(i); + result.stringMatch = matcher.group(1); + result.stringTail = input.substring(matcher.group(1).length()); } } catch (PatternSyntaxException error) { Log.warning(error); -- cgit v1.2.3