Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to remove extra line breaks (using regexp)?

by ikegami (Patriarch)
on Apr 17, 2009 at 14:07 UTC ( [id://758243]=note: print w/replies, xml ) Need Help??


in reply to How to remove extra line breaks (using regexp)?

How can you tell which line break to keep so it doesn't turn into
A6.8.5 This is a example sentence A6.8.6 This is a example sentence
Will the line always start with /A\d+\./?

Replies are listed 'Best First'.
Re^2: How to remove extra line breaks (using regexp)?
by larus (Acolyte) on Apr 17, 2009 at 14:12 UTC
    Well, yeah, that is the problem. There is other shitty thing also in this .txt file that I'm trying to clean but basically the lines that I want to keep starts with a letter and a digit.
      my $file = do { local $/; <DATA> }; $file =~ s/\n(?!A\d+\.)/ /g; $file .= "\n"; print $file; __DATA__ A6.8.5 This is an example sentence A6.8.6 This is an example sentence
      A6.8.5 This is an example sentence A6.8.6 This is an example sentence
        Thanks!!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://758243]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-23 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found