I am trying to capture the URL using regex and i get a result I don’t understand.
This is the example link:
var web = “www.example.com?cid=23233&cid=434343”;
If i match: web.match(/^(.*?)/)
i get only “” in the console log
but, If i match:
in the console log i get the entire link in the first element, and the parenthesis (this time not only with “”) with the link until the ?.
Why the parenthesis manage to capture the link this time, but in the first time they capture only “”