Re: newline regexes

2009-12-09 Thread jackassplus
> It removes all singly occurring newlines. > > This is a negative, zero-width, look-behind assertion (? 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, look-ahe

Re: newline regexes

2009-12-06 Thread Rene Schickbauer
Hi! This is a negative, zero-width, look-behind assertion (? Huh? Until i read this, i actually though i understood regular expressions. That one actually may solve one of my problems, too. Thanks!.. i think... I'm going to have to meditate over that one. LG Rene -- #!/usr/bin/perl #99BoB

Re: newline regexes

2009-12-05 Thread Shawn H Corey
jackassplus wrote: >>> $data =~ s{ (? > 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 (?http://perldoc.perl.org/perlre.html#Extended-Patterns -- Just my 0.0002 million dollars worth, Shawn Pro

Re: newline regexes

2009-12-05 Thread jackassplus
> > $data =~ s{ (?http://learn.perl.org/

Re: newline regexes

2009-12-04 Thread Shawn H Corey
John W. Krahn wrote: > Shawn H Corey wrote: >> $data =~ s{ (? ^^ > Replace pattern with nothing. Oh oh! $data =~ s{ (?http://learn.perl.org/

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 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 = ne

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 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 be