On May 12, 4:58=A0pm, Thomas 'PointedEars' Lahn <PointedE...@[EMAIL PROTECTED]
>
wrote:
> [trimmed attribution novel]
>
>
>
> Rauan Maemirov wrote:
> > Thomas 'PointedEars' Lahn wrote:
> >> Rauan Maemirov wrote:
> >>> I tried to do it myself, but all I did is to replaced
> >>> <object width=3D"425" height=3D"355"><param name=3D"movie"
value=3D"UR=
L"></
> >>> param><param name=3D"wmode" value=3D"transparent"></param><embed
src=
=3D"URL"
> >>> type=3D"application/x-shockwave-flash" wmode=3D"transparent"
width=3D"=
425"
> >>> height=3D"355"></embed></object>
> >>> with
> >>> <object width=3D"425" height=3D"355"><param name=3D"movie"
value=3D"UR=
L"></
> >>> param><param name=3D"wmode" value=3D"transparent"></param><img
src=3D"=
URL"
> >>> type=3D"application/x-shockwave-flash" wmode=3D"transparent"
width=3D"=
425"
> >>> height=3D"355"></embed></object>
> >> [...]
> >> 4. FWIW, in Eclipse I would have used the following parameters:
>
> >> Search for:
> >>
(?s)<object\s+.*?<embed\s+.*?(src=3D".+?")[^>]*?\s+(width=3D.+?>)</embe=
d></object>
>
> >> Replace with:
> >> <img $1 $2 alt=3D"">
>
> >> (Don't forget the `alt' attribute, give it a descriptive value if
> >> possible/applicable!)
>
> >> BTW, QuickREx again came in handy in finding that out:
> >>
<http://www.bastian-bergerhoff.com/eclipse/features/web/QuickREx/toc.ht=
ml>
>
> >> 5. With the exception of `(?s)', which can be worked around with
> >> =A0 =A0`(?:.|[\r\n])' instead of `.', this should also work with
> >> =A0 =A0String.prototype.replace() in JavaScript 1.5+ (Mozilla/5.0),
> >> =A0 =A0JScript 5.5+ (IE 5.5+), ECMAScript Ed. 3+.
> >> [...]
>
> > I tried your regex:
>
> > var flash =3D '<object width=3D"425" height=3D"355"><param
name=3D"movie=
"
> > value=3D"http://www.youtube.com/v/yVjzd320gew&hl=3Den"></param><param
> > name=3D"wmode" value=3D"transparent"></param><embed src=3D"http://
> >www.youtube.com/v/yVjzd320gew&hl=3Den" type=3D"application/x-shockwave-
> > flash" wmode=3D"transparent" width=3D"425" height=3D"355"></embed></
> > object>';
>
> > flash =3D
flash.replace('(?s)<object\s+.*?<embed\s+.*?(src=3D".+?")[^>]*=
?\s
> > +(width=3D.+?>)</embed></object>', '<img $1 $2 alt=3D""> ');
>
> > It returns the same object...
>
> It returns a primitive string value, not an object. =A0It returns the
same=
> string it is being applied to because you have not passed a RegExp
object
> but a string as argument, and you have not read my posting thoroughly
> enough. =A0If you had quoted properly, you would have been forced to
re-re=
ad
> before replying and had probably not made this silly mistake.
>
> PointedEars
> --
> =A0 =A0 realism: =A0 =A0HTML 4.01 Strict
> =A0 =A0 evangelism: XHTML 1.0 Strict
> =A0 =A0 madness: =A0 =A0XHTML 1.1 as application/xhtml+xml
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 -- Bjoern Hoehrmann
Thanks, Thomas. I found my mistake. But there is the next trouble.
What if I have more than one <object>'s. It returns only one image. I
need to construct regexp the way, that it will replace only one
node(tag). E.g. <object>...<embed src=3D"title".../></
object>...<object>...<embed ... width=3D"455".../></object>


|