Extracting a data from a string

W

Walter Roberson

: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.
 
D

Dan

: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
 
T

Tore Aursand

<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 <[email protected]>
"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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top