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