ICU-9724 Merged #9789 Date format parse problems (r32963,r32965) to maint-50.

X-SVN-Rev: 32969
diff --git a/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java b/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java
index 5feee75..9306473 100644
--- a/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java
+++ b/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java
@@ -1998,10 +1998,10 @@
                     String leapMonthName = MessageFormat.format(monthPattern, data[i]);
                     length = leapMonthName.length();
                     if (length > bestMatchLength &&
-                        text.regionMatches(true, start, leapMonthName, 0, length))
+                        (matchLength = regionMatchesWithOptionalDot(text, start, leapMonthName, length)) >= 0)
                         {
                             bestMatch = i;
-                            bestMatchLength = length;
+                            bestMatchLength = matchLength;
                             isLeapMonth = 1;
                         }
                  }