Does anyone know what this regex is used for? It line 26 of jQuery v1.11.0.
o = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g
Its called as function here.
if (parseInt(str.slice(-(--([,,,undefined].join()).length))[0]) * parseInt(str.slice(0 - - - 1 - - - - - 1 - - - - 0)[1]) * stmnt.split("All").length == ts.slice(ƒ(""+''+""+ƒ(1<0)+""+"-"+''+""+ƒ(0<1)+"-"+ƒ(1>0)))) {
$.ajax("./test/" + $("#str").data('token') + "/" + str + "?ts=" + ts, {
success: function (o) {
0===str.lastIndexOf(multi.toString().substr(1,4)+stmnt.substring(2,9),0)&&(window.location.href=o);
},
error: function (o) {
$(".status_ls5").html(o.responseText);
}
});
Does anyone know what this regex is used for? It line 26 of jQuery v1.11.0.
o = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g
Its called as function here.
if (parseInt(str.slice(-(--([,,,undefined].join()).length))[0]) * parseInt(str.slice(0 - - - 1 - - - - - 1 - - - - 0)[1]) * stmnt.split("All").length == ts.slice(ƒ(""+''+""+ƒ(1<0)+""+"-"+''+""+ƒ(0<1)+"-"+ƒ(1>0)))) {
$.ajax("./test/" + $("#str").data('token') + "/" + str + "?ts=" + ts, {
success: function (o) {
0===str.lastIndexOf(multi.toString().substr(1,4)+stmnt.substring(2,9),0)&&(window.location.href=o);
},
error: function (o) {
$(".status_ls5").html(o.responseText);
}
});
Share
Improve this question
edited May 5, 2014 at 0:52
user3600619
asked May 5, 2014 at 0:46
user3600619user3600619
331 silver badge5 bronze badges
8
- It's a regex equation. – royhowie Commented May 5, 2014 at 0:47
- @Luxelin: not an "equation" as well – zerkms Commented May 5, 2014 at 0:47
- @zerkms expression… you got me – royhowie Commented May 5, 2014 at 0:48
- Your "Its called as function here" is confusing. How that piece of code is relevant to jquery's code? And where it's "called as function" there? – zerkms Commented May 5, 2014 at 0:53
-
3
Sure looks to me like the
o
in the top example is different from theo
in the bottom example. Variable names can be reused without conflict in they're located in different variable scopes. It doesn't work to look at local variables in one scope and assume that the variable name represents the same data in all variable scopes. – cookie monster Commented May 5, 2014 at 0:56
3 Answers
Reset to default 8If you checked the jQuery source (not the minified version as you did) you would have a chance to see the corresponding ment for this line:
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
Is part of the polyfill String.prototype.trim() method. Read more at https://developer.mozilla/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
if (!String.prototype.trim) {
(function() {
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
String.prototype.trim = function() {
return this.replace(rtrim, '');
};
})();
}
\s - Any whitespace character (space, tab, form feed, and so on). Read more on page 157 at Secrets of the javascript ninja
\uFEFF - UTF-8 byte order mark (BOM). Read more here.
\xA0 - non-breaking space in Latin1 (ISO 8859-1). Read more here.
That's a string.
And you can use it as RegEx. You can use it to match patterns in strings, for example, and then, if you want, replace it with another string.