[ACCEPTED]-Regex remove everything after : (including :)-regex
Accepted answer
var text = "Foundation: 100";
text = text.replace(/:.*$/, "");
console.log(text);
0
For your example you could call .split(":")
on your 2 string and then select the first array element 1 using "[0]"
var whole_text = "Foundation: 100";
var wanted_text = whole_text.split(":")[0]
console.log(wanted_text)
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.