Will scan this image tag:
--------------------------
<img src="images/animationpundo_schwarz_kl.gif"
alt="Personal und Organisation" border="0" width="84" height="64">
I already tested this with the follow code:
-----------------------------------------------
...scan(/<img.*>/m)
and with
...scan(/<img.*?>/m)
But the result was always:
----------------------------
<img src="images/animationpundo_schwarz_kl.gif"
alt="Personal und Organisation" border="0" width="84"
height="64"></a></td>
<td align="left" valign="top" width="25%"><font face="Arial"><a
href="../personal/po.htm">
I have to replace in a File the image tags with an other!
File Data:
-------------
[trimmed]
Will scan this image tag:
--------------------------
<img src="images/animationpundo_schwarz_kl.gif"
alt="Personal und Organisation" border="0" width="84" height="64">
I already tested this with the follow code:
-----------------------------------------------
...scan(/<img.*>/m)
and with
...scan(/<img.*?>/m)
But the result was always:
----------------------------
<img src="images/animationpundo_schwarz_kl.gif"
alt="Personal und Organisation" border="0" width="84"
height="64"></a></td>
<td align="left" valign="top" width="25%"><font face="Arial"><a
href="../personal/po.htm">
I hope someone can help me! Thanks a lot!
I'd agree with your choice of regexp. I think we need to see more of
the surrounding code to fix this.
I have to replace in a File the image tags with an other!
As another poster has pointed out, you aren't showing enough code for an
analysis, and, while you are replacing tags, please reformat your IMG tags
thus:
<img src="..."/>
Note the self-closing form. This won't bother older browsers, and it will
allow you to meet the newer (X)HTML standards as well.
Here is sample program that extracts all the IMG tags from a Web page (of
both the old and new varieties):
On 11/16/06, Paul Lutus <nospam@nosite.zzz> wrote:
Ajay Vijey wrote:
> Hallo @ all,
>
> I have to replace in a File the image tags with an other!
As another poster has pointed out, you aren't showing enough code for an
analysis, and, while you are replacing tags, please reformat your IMG tags
thus:
<img src="..."/>
Note the self-closing form. This won't bother older browsers, and it will
allow you to meet the newer (X)HTML standards as well.
Here is sample program that extracts all the IMG tags from a Web page (of
both the old and new varieties):
Works for me with datei_new.scan(/(<img.*?>)/m) (the .*? performs a
non-greedy match so it stops with the smallest match it can make,
rather than the longest)
The parentheses you have around the text of the regexp are unnecessary,
they cause the results to be more deeply nested in arrays. You should
use /<img.*?>/m