Extracting a data from a string

Discussion in 'Perl Misc' started by Dan, May 28, 2004.

  1. Dan

    Dan Guest

    Good morning/evening,

    Having a string like

    <img src="http://mywebsite_address/mypath/-picture.gif"></a><br>


    How can I extract "-picture.gif" from this string ?

    The name will, for example, always begin by "-"
    It will be for example -pic1gif, or -pic8.gif, etc.

    Thank you,

    Dan
     
    Dan, May 28, 2004
    #1
    1. Advertising

  2. Gunnar Hjalmarsson, May 28, 2004
    #2
    1. Advertising

  3. In article <>,
    Dan <> wrote:
    :Having a string like

    :<img src="http://mywebsite_address/mypath/-picture.gif"></a><br>

    :How can I extract "-picture.gif" from this string ?


    :The name will, for example, always begin by "-"
    :It will be for example -pic1gif, or -pic8.gif, etc.

    And will it *always* be on one line? No possibility of it having
    been split by printable-quoted into something such as

    <img src="http://mywebsite_address/mypath/-pict=
    ure.gif"></a><br>

    ??

    And is it certain that there will be the closing double-quote? The
    HTML spec does not strictly require that all strings be double-quoted,
    only strings that have certain characters in them.

    What are the valid characters in the name?

    my ($fid) = $string =~ /(-[a-zA-Z0-9.]+)"/

    But this wouldn't match names that included imbedded dashes or
    underscores or characters such as & or blanks -- you have failed to
    give us a specification of what *is* allowed in the filenames.
    --
    "Infinity is like a stuffed walrus I can hold in the palm of my hand.
    Don't do anything with infinity you wouldn't do with a stuffed walrus."
    -- Dr. Fletcher, Va. Polytechnic Inst. and St. Univ.
     
    Walter Roberson, May 28, 2004
    #3
  4. Dan

    Dan Guest

    On 28 May 2004 15:48:19 GMT, -cnrc.gc.ca (Walter
    Roberson) wrote:

    >In article <>,
    >Dan <> wrote:
    >:Having a string like
    >
    >:<img src="http://mywebsite_address/mypath/-picture.gif"></a><br>
    >
    >:How can I extract "-picture.gif" from this string ?
    >
    >
    >:The name will, for example, always begin by "-"
    >:It will be for example -pic1gif, or -pic8.gif, etc.
    >
    >And will it *always* be on one line? No possibility of it having
    >been split by printable-quoted into something such as
    >
    ><img src="http://mywebsite_address/mypath/-pict=
    >ure.gif"></a><br>



    No, always one line as described above, with the double-quotes

    Better even, all before the sign "-" will be always the same. The only
    variable is the name of the gif file itself.

    The pics will *always* be nammed -picturexxxxx.gif
    where xxxx are digits, and only.

    Dan
     
    Dan, May 28, 2004
    #4
  5. Dan

    Tore Aursand Guest

    On Fri, 28 May 2004 19:38:05 +0400, Dan wrote:
    > <img src="http://mywebsite_address/mypath/-picture.gif"></a><br>
    >
    > How can I extract "-picture.gif" from this string ?


    perldoc HTML::LinkExtor
    perldoc perlretut


    --
    Tore Aursand <>
    "Scientists are complaining that the new "Dinosaur" movie shows
    dinosaurs with lemurs, who didn't evolve for another million years.
    They're afraid the movie will give kids a mistaken impression. What
    about the fact that the dinosaurs are singing and dancing?" (Jay Leno)
     
    Tore Aursand, May 28, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. R
    Replies:
    2
    Views:
    539
    Jon A. Cruz
    Jul 25, 2003
  2. Mar Thomas

    Extracting a string

    Mar Thomas, Sep 26, 2003, in forum: Java
    Replies:
    9
    Views:
    394
    Tony Morris
    Jan 15, 2004
  3. Zoran Cutura

    Re: extracting string

    Zoran Cutura, Jun 26, 2003, in forum: C Programming
    Replies:
    0
    Views:
    736
    Zoran Cutura
    Jun 26, 2003
  4. Dylan
    Replies:
    3
    Views:
    390
    Maxim Yegorushkin
    Aug 10, 2005
  5. Rene Ivon Shamberger

    extracting data from std::set<string>

    Rene Ivon Shamberger, Oct 19, 2012, in forum: C++
    Replies:
    2
    Views:
    254
Loading...

Share This Page