I am having an issue to replace "\r\n Departing\r\n " with "Departing" in javascript.
Please suggest best way to do this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This should work:
g => global
m => multi-line
i => case-insesitive
[^a-z] => chars, a to z, but thanks to case-insensitivity A-Z are not replaced, either.
If numbers might occur in the string, you can prevent them from being replaced pretty easily:
If all you want to do is remove line-feeds and trim the remaining string:
Should take care of things for you rather nicely