1

I'm trying to make a small link share function with Classic ASP like LinkedIn or Facebook.

What I need to do is to get HTML of remote URL and extract all the images whose width are greater than 50px for example.

I can crawl and take the HTML and also I can find the images with this regex:

<img([^<>+]*)>

It matches; <img src="/images/icon.jpg" width="60" height="90" style="display:none"/>

Then I'm able to extract the path but sometimes it matches <img src="/track.php" style="display:none" width="1" height="1"/> which is not a real image.

Anyway, I feel like you are gonna be mad because of classic ASP but my company ....

I know there are lots of topics about this issue and mostly, they recommend not to USE regex but I couldn't find a way to this with classic asp. Is there a component or something to this?

Regards

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Burak F. Kilicaslan
  • 535
  • 2
  • 8
  • 20

1 Answers1

0

This will get you close:

<img [^>]*width="(0?[1-9]\d{2,}|[5-9]\d)"[^>]*>

It accepts image tags with a width of 50 or greater.

Edit: tags with unspecified widths:

<img [^>]*width="(0?[1-9]\d{2,}|[5-9]\d)"[^>]*>|<img ((?!width=)[^>])*>
agent-j
  • 27,335
  • 5
  • 52
  • 79