I'm referring to a book and it has code I can't understand:
http.createServer(function(req,res){
// normalize url by removing querystring, optional
// trailing slash, and making lowercase
var path = req.url.replace(/\/?(?:\?.*)?$/, '').toLowerCase();
}
I have a problem in the following line:
var path = req.url.replace(/\/?(?:\?.*)?$/, '').toLowerCase();
What is that first argument of replace method?