Escape special chars as separator (fix by elzoiddy)

master
Trent Richardson 2011-03-11 09:41:39 -05:00
parent 1a2a371deb
commit caf2916169
1 changed files with 3 additions and 1 deletions

View File

@ -208,7 +208,9 @@ $.extend(Timepicker.prototype, {
// the time should come after x number of characters and a space.
// x = at least the length of text specified by the date format
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
regstr = '.{' + dp_dateFormat.length + ',}' + this._defaults.separator + regstr;
// escape special regex characters in the seperator
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g");
regstr = '.{' + dp_dateFormat.length + ',}' + this._defaults.separator.replace(specials, "\\$&") + regstr;
}
treg = timeString.match(new RegExp(regstr, 'i'));