Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Regular Expressions
  4. getting all the image files in a HTML Inspection

getting all the image files in a HTML Inspection

Scheduled Pinned Locked Moved Regular Expressions
questionhtmlregex
4 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14634880
    wrote on last edited by
    #1

    Hi All. Quick question: I want to find all of the images on a webpage, so I created a regex string as follows:

    http(s)?://[a-zA-Z0-9]\S+.(jpg|jpeg|bmp|gif|tif|png|webp)

    And it works. However since not all images start with http or https, I keep missing some images. How can I make this string say "So long as you end with a suffix in the group, get it. Regards

    L 1 Reply Last reply
    0
    • M Member_14634880

      Hi All. Quick question: I want to find all of the images on a webpage, so I created a regex string as follows:

      http(s)?://[a-zA-Z0-9]\S+.(jpg|jpeg|bmp|gif|tif|png|webp)

      And it works. However since not all images start with http or https, I keep missing some images. How can I make this string say "So long as you end with a suffix in the group, get it. Regards

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Have you tried removing the http(s)?:// prefix?

      M 1 Reply Last reply
      0
      • L Lost User

        Have you tried removing the http(s)?:// prefix?

        M Offline
        M Offline
        Member_14634880
        wrote on last edited by
        #3

        Hi. Yes I have done that, but for some reason I still get the src:" in the web page HTML matches. And I don't know why. Do I have to ignore that Somehow with a /S? Regards

        L 1 Reply Last reply
        0
        • M Member_14634880

          Hi. Yes I have done that, but for some reason I still get the src:" in the web page HTML matches. And I don't know why. Do I have to ignore that Somehow with a /S? Regards

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I guess that is correct, you will need to strip that manually somehow. Alternatively check if there is some other match that prefixes all the links that do not start with http(s).

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups