Forgive me if this is a double post, but I couldn’t find a similair one that worked for me.
I have a domain name ex. google.co.uk (but this can also be google.com). I need to split this on the first period so I get an array object like this: ["google", "co.uk"] or ["google", "com"]
In antoher post I found this: 'google.co.uk'.split(/.(.+)?/)[1]; but that doesn’t seem to work…
Can anyone help me? Thanks in advance!
Replace the first . with something else that will never turn up in the string (such as |), then split off that character.
As str.replace only replaces the first instance of the character it finds by default, the code is pretty simple: