19 users online (0 members and 19 guests)  


  Results 1 to 2 of 2

Related

  1. Radio Buttons Return Nothing    Forum: HTML Forum
    Replies: 7
  2. How to return to previous page    Forum: Javascript Forum
    Replies: 0
  3. Automaticaly return to top of page    Forum: HTML Forum
    Replies: 1
  4. Replies: 0
  5. Return Form Answers - Perl    Forum: CGI Perl Forum
    Replies: 8
  1. #1
    djbryson's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2006
    Posts
    1

    trap carriage return - perl/windows

    I'm trying to account for possible carriage returns in a file.
    I'm looking for: <meta name="author" content="John Doe">
    But sometimes there's extra spaces by accident or even a carriage return
    This works fine for extra spaces:
    /<meta *name="author" *content="[azAZ '-]?">/is
    and this works fine for only carriage returns:
    /<meta (\r|\n)name="author" (\r|\n)content="[azAZ '-]?">/is
    and this works fine if there's only one or the other:
    /<meta *(\r|\n)name="author" *(\r|\n)content="[azAZ '-]?">/is
    but if there's spaces and carriage returns it doesn't work.
    Oh, maybe it's (\r\n) without the or???
    *note, i'm running my perl script against local files on a windows 2000 box, not Unix/Linux.
    help

  2. #2
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: trap carriage return - perl/windows

    a while ago i was working on a similer thing... and found it is much eassier if you do something more like this:

    <([a-zA-Z0-9_-]+)[\s\t]*name="(.*[^\\"]*.*)*"(.*)>

    this is untested so probably wont work, but you get the idea. what it is SUPPOSED to do is trak everything in the in between the name's double quotes. and exclude \" so you can have a " in there and keep it from erroring.

    -ALL