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