MEM MEM - 2 years ago 138
Javascript Question

javascript grab part of a string after a . (dot)

I'm unable to read regex.

Let's say we have this string: "mydomain.bu.pu" and I want to grab the ".bu.pu" part of it;

I'm thinking about using something like:

indexOf and later substr ... But I confess I'm kind of lost...

Any help please? :D

Thanks in advance,

Answer Source
var afterDot = str.substr(str.indexOf('.'));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download