i have a following value i want to trim "mi" and other white values from the below figure.
value= 8.8 mi
the value may change every time but will come with mi.
Use regex to remove the text from the end of the string:
var expr = / mi$/;
var value2 = value.replace(expr, "");
And like h2ooooooo commented, you can use a group to match on:
var expr = / (hr|mi|sec)$/;
/ (mi|foo|bar)$/.
c#tag?