         if (pattern)
         {
             // 'L' is not supported by most systems so relace with 'M'
-            // Problem if pattern has L or c in string literals. 
-            // TBD: Discuss with Masa.
-            pattern = pattern.replace(/L/g, "M");
-            // ru locale uses c as symbol for day name of the week instead E.
-            // catering to only skeleton patterns.
-            pattern = pattern.replace(/ccc/g, "EEE");
+            pattern = pattern.replace(REGEXP_L, function(
+                matchedSubstring:String,
+                capturedMatch1:String, index:int, str:String):String
+            {
+                return replaceString(matchedSubstring,
+                    capturedMatch1, index, str, "M");
+            });
+            
+            // ru locale uses "c" as the symbol for the day name of the week
+            // instead "E".
+            pattern = pattern.replace(REGEXP_c, function(
+                matchedSubstring:String,
+                capturedMatch1:String, index:int, str:String):String
+            {
+                return replaceString(matchedSubstring,
+                    capturedMatch1, index, str, "E");
+            });
         }
         
         return pattern;

        return element ? element["index"] : -1;
    }
    
    /**
     *  Formatting pattern for the day of week.
     *

                    break;
            }
            if (element)
                elementList.push(element);
        }
    }
    
    /**
     *  @private
     *  extractTimeElements() function.
     *
     *  @langversion 3.0
     *  @playerversion Flash 11
     *  @playerversion AIR 3
     *  @productversion Flex 4.5.2
     */
    private static function extractTimeElements(
        pattern:String, elementList:Array):void
    {
        var regExpOut:Object;
        for (var i:int = 0; i < 4; i++)
        {
            var element:Object = null;
            switch (i)
            {
                case 0:
                    regExpOut = REGEXP_HOUR.exec(pattern);
                    if (regExpOut)
                        element = { name: "hour", pattern: regExpOut[2],
                            index: ((regExpOut["index"] as int)
                                + (regExpOut[1] as String).length) };
                    break;
                case 1:
                    regExpOut = REGEXP_MINUTE.exec(pattern);
                    if (regExpOut)
                        element = { name: "minute", pattern: regExpOut[2],
                            index: ((regExpOut["index"] as int)
                                + (regExpOut[1] as String).length) };
                    break;
                case 2:
                    regExpOut = REGEXP_SECOND.exec(pattern);
                    if (regExpOut)
                        element = { name: "second", pattern: regExpOut[2],
                            index: ((regExpOut["index"] as int)
                                + (regExpOut[1] as String).length) };
                    break;
                case 3:
                    regExpOut = REGEXP_AMPM.exec(pattern);
                    if (regExpOut)
                        element = { name: "ampm", pattern: regExpOut[2],
                            index: ((regExpOut["index"] as int)
                                + (regExpOut[1] as String).length) };
                    break;
            }
            if (element)
                elementList.push(element);
        }
    }
}
}
