Last word in string Just splitting into array and pop JavaScript var test = "this is a test 123"; var result = $(test.split(" ").pop()); alert(result);