Escape special chars as separator (fix by elzoiddy)
This commit is contained in:
parent
1a2a371deb
commit
caf2916169
4
jquery-ui-timepicker-addon.js
vendored
4
jquery-ui-timepicker-addon.js
vendored
|
@ -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'));
|
||||
|
|
Loading…
Reference in a new issue