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,
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.
$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
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
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
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
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
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
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
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
10 matches
Mail list logo