I have several different document formats coming in. I’d like to strip out all the newlines and replace them with a " ". How can I account for newlines other than "\n"?
Something like s.gsub("\n", " ")
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.
Most operating systems use
\nor\r(or a combination) for newlines.s.gsub(/[\n\r]+/, " ")should do the trick./[\n\r]+/is known as a regular expression. It matches\n,\rand any combination of the two.