Re: newline regexes

2009-12-09 Thread jackassplus
It removes all singly occurring newlines. This is a negative, zero-width, look-behind assertion (?! \n )  It means that the variable does not match what it contains, in this case a newline, before the match but do not include what it matches in the match. This is a negative, zero-width,

Re: newline regexes

2009-12-06 Thread Rene Schickbauer
Hi! This is a negative, zero-width, look-behind assertion (?! \n ) It means that the variable does not match what it contains, in this case a newline, before the match but do not include what it matches in the match. Huh? Until i read this, i actually though i understood regular expressions.

Re: newline regexes

2009-12-05 Thread jackassplus
$data =~ s{ (?! \n ) \n (?! \n ) }{}gmsx; I have no Idea what that is supposed to do. the output from that is: \nSynopsis :\n\nA file / print sharing service is listening on the remote host.\n\nDescription :\n\nThe remote service understands the CIFS (Common Internet File System)\nor Server

Re: newline regexes

2009-12-05 Thread Shawn H Corey
jackassplus wrote: $data =~ s{ (?! \n ) \n (?! \n ) }{}gmsx; I have no Idea what that is supposed to do. It removes all singly occurring newlines. This is a negative, zero-width, look-behind assertion (?! \n ) It means that the variable does not match what it contains, in this case a

newline regexes

2009-12-04 Thread jackassplus
I am trying to remove single newlines but not double newlines. for instance say I have the following: Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text that\nhas some newlines that\nI want to be rid of\n\nThe End\n I want to get rid of all of the newlines between Me:\n and the

Re: newline regexes

2009-12-04 Thread John W. Krahn
jackassplus wrote: I am trying to remove single newlines but not double newlines. for instance say I have the following: Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text that\nhas some newlines that\nI want to be rid of\n\nThe End\n I want to get rid of all of the newlines

Re: newline regexes

2009-12-04 Thread Shawn H Corey
jackassplus wrote: I am trying to remove single newlines but not double newlines. for instance say I have the following: Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text that\nhas some newlines that\nI want to be rid of\n\nThe End\n I want to get rid of all of the

Re: newline regexes

2009-12-04 Thread jackassplus
The string \\n will not match a newline, it will match the two characters '\' and 'n'. I believe that's what I'm doing. Here is my test harness until I get this worked out: Input is from an XML File. #!/usr/bin/perl -w # load modules use DBI; use XML::Simple; # create xml object $xml = new

Re: newline regexes

2009-12-04 Thread John W. Krahn
Shawn H Corey wrote: jackassplus wrote: I am trying to remove single newlines but not double newlines. for instance say I have the following: Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text that\nhas some newlines that\nI want to be rid of\n\nThe End\n I want to get rid of

Re: newline regexes

2009-12-04 Thread Shawn H Corey
John W. Krahn wrote: Shawn H Corey wrote: $data =~ s{ (?! \n ) \n (?! \n ) }{}gmsx; ^^ Replace pattern with nothing. Oh oh! $data =~ s{ (?! \n ) \n (?! \n ) }{ :P }gmsx; -- Just my 0.0002 million dollars worth, Shawn Programming is as much about