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

MEM picture MEM · Nov 3, 2010 · Viewed 16.7k times · Source

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, MEM

Answer

kijin picture kijin · Nov 3, 2010
var afterDot = str.substr(str.indexOf('.'));