Reputation: 2198
Lets say I have JavaScript variable with a string as value like thi
var string; string = "ushjsb\n laKDJV\n";
How can I by using regexp delete ONLY the last linebreak?
Upvotes: 1
Views: 34
Reputation: 3217
Use:
string = string.replace(/\n+$/, "")
Upvotes: 2