From 6ecb0a30c3f705ec33b6516194e32bbe29e6a1d7 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Thu, 27 Sep 2012 11:50:52 +0000 Subject: [PATCH] LANG-830 FastDateParser could use \Q \E to quote regexes git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1390954 13f79535-47bb-0310-9956-ffa450edef68 --- src/changes/changes.xml | 1 + .../commons/lang3/time/FastDateParser.java | 33 +++++++++++-------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 39e83430e..ed00ddfa0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -24,6 +24,7 @@ FastDateParser does not handle unterminated quotes correctly FastDateParser does not handle white-space properly + FastDateParser could use \Q \E to quote regexes FastDateParser does not handle non-Gregorian calendars properly FastDateParser does not handle non-ASCII digits correctly Create StrBuilder APIs similar to String.format(String, Object...) diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java index 609618e26..4618262df 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java @@ -297,6 +297,7 @@ public class FastDateParser implements DateParser, Serializable { * @return The StringBuilder */ private static StringBuilder escapeRegex(StringBuilder regex, String value, boolean unquote) { + regex.append("\\Q"); for(int i= 0; i