Wednesday, 7 August 2013

Could anyone give an explain on following javascript RE code?

Could anyone give an explain on following javascript RE code?

Could anyone give an explain on following example code? it's from the last
example here.
Not sure why there's no '\' before the '.' , it can get same result by
adding '\'.
var url = "http://xxx.domain.com";
print(/[^.]+/.exec(url)[0].substr(7)); // prints "xxx"

No comments:

Post a Comment