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
var afterDot = str.substr(str.indexOf('.'));
The above answers include the dot in the string. If you only want what's after the dot:
var afterDot = str.substr( str.indexOf('.') + 1 );
s = s.substring(s.indexOf("."));
That should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With