Skip to content Skip to sidebar Skip to footer

Regexp Not Cutting Url Proprerly

I have the following code which is giving me a few headaches as all seems to work fine on paper, but when I put it in practice it gives me weird results. The purpose of the code is

Solution 1:

Try this

var url;
url = 'www.thingiverse.com'
url = 'www.google.co.uk'
var domainurlcut = /(\w*.)([\w.-\/]*)/.exec(url);

console.log(domainurlcut);
var result = domainurlcut[2];

alert(result);

Post a Comment for "Regexp Not Cutting Url Proprerly"