I am using this expression in my code to remove blank spaces in a string.
var TestString= some string with blank spaces and/or new lines;
TestString=TestString.replace(/^\ \;|<br?\>*/gi, '').replace(/\ \;|<br?\>$/gi, '').trim();
Now this Regular expression removes a new line also.what i need is it should remove spaces at start at end but not when enter is pressed that is when new line is created.
Any idea how do i modify this expression to achieve that?
Edit after some research:
TestString=TestString.replace(/&[^;]+;/g, '').replace(/<br\s*\/?>/mg,'\n');
If i use this expression it shows them with new line but after uploading it doesn't show them as that.Any idea why is it so? Is it not possible to make a new line in editable table td element?
将多行模式“ m”添加到“ / gi”是否可行?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.