Click here to get back home

Regex, how do I replace quotation pairs into
  • &
  • ?

     HomeNewsGroups | Search | About
     comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
    Subject Author Date
    Regex, how do I replace quotation pairs into
  • &
  • ?
    Kelvin 10-21-2004
    Get Chitika Premium
    Posted by Kelvin on October 21, 2004, 7:27 pm
    Please log in for more thread options
    >>
    >> [snip]
    >>
    >> > if I print "$1\n",
    >> > the file prints just fine. But, if I do something like print "$1 after
    >> > \n", the whole output is messed up. If I print "before $1\n", nothing
    >> > prints at all. If I print "before $1 after\n", only after prints.
    >>
    >> not really sure, but could be a rogue "\r" in $1,


    > There
    > is a rogue carriage return (0xd) in the string

    > Is there something I can do to deal with this
    > situation?


    Repair the corrupted file:

    perl -p -i -e 'tr/\r//d' bad_file


    --
    Tad McClellan SGML consulting
    tadmc@augustmail.com Perl programming
    Fort Worth, Texas

    Posted by Gerhard M on October 21, 2004, 10:56 am
    Please log in for more thread options
    >>
    >> [snip]
    >>
    >> > if I print "$1\n",
    >> > the file prints just fine. But, if I do something like print "$1 after
    >> > \n", the whole output is messed up. If I print "before $1\n", nothing
    >> > prints at all. If I print "before $1 after\n", only after prints.
    >>
    >> not really sure, but could be a rogue "\r" in $1,


    > There
    > is a rogue carriage return (0xd) in the string

    > Is there something I can do to deal with this
    > situation?


    Repair the corrupted file:

    perl -p -i -e 'tr/\r//d' bad_file


    --
    Tad McClellan SGML consulting
    tadmc@augustmail.com Perl programming
    Fort Worth, Texas

    Posted by Gunnar Hjalmarsson on October 21, 2004, 2:13 pm
    Please log in for more thread options
    >>
    >> [snip]
    >>
    >> > if I print "$1\n",
    >> > the file prints just fine. But, if I do something like print "$1 after
    >> > \n", the whole output is messed up. If I print "before $1\n", nothing
    >> > prints at all. If I print "before $1 after\n", only after prints.
    >>
    >> not really sure, but could be a rogue "\r" in $1,


    > There
    > is a rogue carriage return (0xd) in the string

    > Is there something I can do to deal with this
    > situation?


    Repair the corrupted file:

    perl -p -i -e 'tr/\r//d' bad_file


    --
    Tad McClellan SGML consulting
    tadmc@augustmail.com Perl programming
    Fort Worth, Texas

    Posted by Tore Aursand on October 21, 2004, 3:45 pm
    Please log in for more thread options
    >>
    >> [snip]
    >>
    >> > if I print "$1\n",
    >> > the file prints just fine. But, if I do something like print "$1 after
    >> > \n", the whole output is messed up. If I print "before $1\n", nothing
    >> > prints at all. If I print "before $1 after\n", only after prints.
    >>
    >> not really sure, but could be a rogue "\r" in $1,


    > There
    > is a rogue carriage return (0xd) in the string

    > Is there something I can do to deal with this
    > situation?


    Repair the corrupted file:

    perl -p -i -e 'tr/\r//d' bad_file


    --
    Tad McClellan SGML consulting
    tadmc@augustmail.com Perl programming
    Fort Worth, Texas

    Similar ThreadsPosted
    Regex help: delete text only if not within quotation marks May 23, 2005, 7:40 pm
    regex search and replace July 30, 2005, 7:07 am
    Want regex s/// to replace only nth occurrence July 6, 2008, 9:17 am
    RegEx replace "bracketed text" April 16, 2006, 1:36 pm
    regex replace credit card numbers with * September 29, 2005, 6:41 am
    Regex failed to replace utf8 character November 29, 2006, 12:25 pm
    Perl Regex substitution: replace nth occurrance April 9, 2008, 2:44 am
    Passing in the replace string for a regex via the command line -HOW? March 3, 2005, 12:47 pm
    regex multi-line match/replace issue April 24, 2006, 4:18 pm
    How to match () pairs July 25, 2008, 8:05 pm

    Our other projects:

    Art Dolls, Fairies and Mermaids - Sunnyfaces.net

    Roy's Linux, Programming and Search Engines messages

    1-Script XML SitemapXML Sitemap