Hi guys,
I'm reading a js file at here, on the very top of this js file you can find the following lines:
var
gsAgent=navigator.userAgent.toLowerCase(),
gsAppVer=navigator.appVersion.toLowerCase(),
gsAppName=navigator.appName.toLowerCase(),
gbIsOpera=gsAgent.indexOf("opera")>-1,
gbIsKHTML=gsAgent.indexOf("khtml")>-1
||gsAgent.indexOf("konqueror")>-1||gsAgent.indexOf("applewebkit")>-1,
gbIsSafari=gsAgent.indexOf("applewebkit")>-1,
gbIsIE=(gsAgent.indexOf("compatible")>-1&&!gbIsOpera)
||gsAgent.indexOf("msie")>-1,
gbIsTT=gbIsIE?(gsAppVer.indexOf("tencenttraveler")!=-1?1:0):0,
gbIsFF=gsAgent.indexOf("gecko")>-1&&!gbIsKHTML,
gbIsNS=!gbIsIE&&!gbIsOpera&&!gbIsKHTML&&(gsAgent.indexOf("mozilla")==0)
&&(gsAppName=="netscape"),
gbIsAgentErr=!(gbIsOpera||gbIsKHTML||gbIsSafari||gbIsIE||gbIsTT
||gbIsFF||gbIsNS),
gbIsWin=gsAgent.indexOf("windows")>-1||gsAgent.indexOf("win32")>-1,
gbIsVista=gbIsWin&&(gsAgent.indexOf("nt 6.0")>-1||gsAgent.indexOf("windows vista")>-1),
gbIsWin7=gbIsWin&&gsAgent.indexOf("nt 6.1")>-1,
gbIsMac=gsAgent.indexOf("macintosh")>-1||gsAgent.indexOf("mac os x")>-1,
gbIsLinux=gsAgent.indexOf("linux")>-1,
gbIsAir=gsAgent.indexOf("adobeair")>-1,
gnIEVer=/MSIE (\d+.\d+);/i.test(gsAgent)&&parseFloat(RegExp["$1"]),
gsFFVer=/firefox\/((\d|\.)+)/i.test(gsAgent)&&RegExp["$1"],
gsSafariVer=/version\/((\d|\.)+)/i.test(gsAgent)&&RegExp["$1"],
gsChromeVer=/chrome\/((\d|\.)+)/i.test(gsAgent)&&RegExp["$1"];
Now my question is what does it mean by RegExp["$1"], I can't find this syntax on the js documentation, but it's somewhat like Ruby's regex syntax. Can anyone explain it please? Great thanks.
PS: Thanks S.Mark, now I know I can use it like this:
var a="abc23de";
alert(/(\d+)/.test(a)&&parseInt(RegExp["$1"]));
But where can I find the documentation of this syntax? Even the famous book JavaScript the definitive guide has not mentioned that RegExp can be used like this.