Copy link to clipboard
Copied
I am loading the images from RSS feed, it works perfectly with .jpg images, but not .png or any other formates. here is my code:
function getImgUrl(str:String):String {
var pattern:RegExp = /src=\"([^\"]+\.jpg|gif|tiff|jpeg|png)/ig;
can some one help Me please.
thanks,
Naveen
Expression is missing brackets - it needs to group alterations. It should be:
/src=\"([^\"]+\.(jpg|gif|tiff|jpeg|png))/ig;
Copy link to clipboard
Copied
first test if it works if you exchange the positions of your jpg/png file formats inside your regular Expression.
if yes: then sth in the syntax of your pattern is faulty
if no: somehow your application can only work with jpg images (look how to use PNGEncoder in a as3)
Copy link to clipboard
Copied
Hi Moccamaximum,
I exchanged the position of jpg/png and it works only for png images, here is the code:
var pattern:RegExp = /src=\"([^\"]+\.png|gif|tiff|jpeg|png)/ig;
I think im missing somthing on my syntax for identifing all the formates of images (jpg/png/tiff/gif/jpeg).
Copy link to clipboard
Copied
I´m really no expert in regExp, sorry, hopefully some on this forum that are, will read your post 😉
Copy link to clipboard
Copied
thank you
Copy link to clipboard
Copied
Expression is missing brackets - it needs to group alterations. It should be:
/src=\"([^\"]+\.(jpg|gif|tiff|jpeg|png))/ig;
Copy link to clipboard
Copied
working perfectly thank you very much Andrei
Copy link to clipboard
Copied
You're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now