Solved

Remove newlines from string

Posted on 1998-11-19
3
819 Views
Last Modified: 2008-03-03
How can I remove all newlines from a string?
ie:
$a = "whatever including newlines";
$a =~ /whatever without newlines/;
0
Comment
Question by:Lee5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 1206368
  chop $a;
or
   chomp $a;
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1206369
oops, if they are not at end of string:

   $a =~ s/[\r\n]+//;

0
 

Author Comment

by:Lee5
ID: 1206370
The oops did the trick
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question