get string till first space javascript code example Example: js get first space in string str.match(/^(\S+)\s(.*)/).slice(1)