{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
AJAX Source Viewer
View the source code of a Method from ASP.NET AJAX Library. Choose a method from the menu items above (Namespaces, Classes, or Methods).
Method '_getParseRegExp(dtf, format)'
Method: _getParseRegExp(dtf, format)
Method Full Name:     Date$_getParseRegExp(dtf, format)
Class: Date
Namespace: Global (MicrosoftAjax.debug.js)
Source File: MicrosoftAjax.debug.js
1   Date._getParseRegExp = function Date$_getParseRegExp(dtf, format) {
2     if (!dtf._parseRegExp) {
3       dtf._parseRegExp = {};
4     }
5     else if (dtf._parseRegExp[format]) {
6       return dtf._parseRegExp[format];
7     }
8     var expFormat = Date._expandFormat(dtf, format);
9     expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1");
10    var regexp = new Sys.StringBuilder("^");
11    var groups = [];
12    var index = 0;
13    var quoteCount = 0;
14    var tokenRegExp = Date._getTokenRegExp();
15    var match;
16    while ((match = tokenRegExp.exec(expFormat)) !== null) {
17      var preMatch = expFormat.slice(index, match.index);
18      index = tokenRegExp.lastIndex;
19      quoteCount += Date._appendPreOrPostMatch(preMatch, regexp);
20      if ((quoteCount%2) === 1) {
21        regexp.append(match[0]);
22        continue;
23      }
24      switch (match[0]) {
25        case 'dddd': case 'ddd':
26        case 'MMMM': case 'MMM':
27          regexp.append("(\\D+)");
28          break;
29        case 'tt': case 't':
30          regexp.append("(\\D*)");
31          break;
32        case 'yyyy':
33          regexp.append("(\\d{4})");
34          break;
35        case 'fff':
36          regexp.append("(\\d{3})");
37          break;
38        case 'ff':
39          regexp.append("(\\d{2})");
40          break;
41        case 'f':
42          regexp.append("(\\d)");
43          break;
44        case 'dd': case 'd':
45        case 'MM': case 'M':
46        case 'yy': case 'y':
47        case 'HH': case 'H':
48        case 'hh': case 'h':
49        case 'mm': case 'm':
50        case 'ss': case 's':
51          regexp.append("(\\d\\d?)");
52          break;
53        case 'zzz':
54          regexp.append("([+-]?\\d\\d?:\\d{2})");
55          break;
56        case 'zz': case 'z':
57          regexp.append("([+-]?\\d\\d?)");
58          break;
59        }
60        Array.add(groups, match[0]);
61      }
62      Date._appendPreOrPostMatch(expFormat.slice(index), regexp);
63      regexp.append("$");
64      var regexpStr = regexp.toString().replace(/\s+/g, "\\s+");
65      var parseRegExp = {'regExp': regexpStr, 'groups': groups};
66      dtf._parseRegExp[format] = parseRegExp;
67      return parseRegExp;
68    }
This is the JavaScript source for method _getParseRegExp(dtf, format) from ASP.NET AJAX Library. Full name for this method is Date$_getParseRegExp(dtf, format). It belongs to the class Date, which is in Global (MicrosoftAjax.debug.js) namespace. This source is in MicrosoftAjax.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map