in reply to Re^5: Reg exp questions
in thread Reg exp questions

well I have a file a lines and there is \n between lines. In order to send an example of what I have in one string, I included \n in the string. Otherwise, it's like

HeadeRdfsldjf(djfls)jfslfk kfd

lfjslfjsflk

dkflskfs

HeadeRRdfsldjf(djfls)jfslfk kfd

lfjslfjsflk

dkflskfs

in the header line, ()\s should be replaced by _, \n at the end should be replaced by \s, on the following lines without Header, \n should be removed except the last one so that it won't be concatenated with the next header line:

HeadeRdfsldjf_djfls_jfslfk_kfd lfjslfjsflkdkflskfs

HeadeRdfsldjf_djfls_jfslfk_kfd lfjslfjsflkdkflskfs

=~ s/\\n/ /g; doesn't work for me. I don't get space instead of \n.

Replies are listed 'Best First'.
Re^7: Reg exp questions
by Anonymous Monk on Nov 08, 2014 at 08:08 UTC
    \s doesn't mean 'space', it means 'ascii/unicode whitespace characters', which include, among others, newline, tab, space.