With JavaScript, how can I remove every thing after last coma character in a string using regular expressions?
For example if i input Vettucaud, Thiruvananthapuram, Kerala, India
,last word India
should be removed and the output need tro be like Vettucaud, Thiruvananthapuram, Kerala
Exactly the reverse thing in
Simple:
str = str.replace(/,[^,]+$/, "")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With