Hi everyone, I have a line like: "Foundation: 100"
I want to use the JS regex to remove everything after: include (:)
Thanks for any help!
var text = "Foundation: 100"; text = text.replace(/:.*$/,""); console.log(text);
As an example, you can call .split(":") on your line, and then select the first element of the array using "[0]"
.split(":")
"[0]"
var whole_text = "Foundation: 100"; var wanted_text = whole_text.split(":")[0] console.log(wanted_text)