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. C#
  4. Regular Expression for images

Regular Expression for images

Scheduled Pinned Locked Moved C#
regexquestionhtml
2 Posts 2 Posters 0 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.
  • B Offline
    B Offline
    brunoconde
    wrote on last edited by
    #1

    Hello!! I need to get the size of all images from an html page but i cant do one thing. Whith this expression i get only images where heigth and width come in this order. Ex: i can make only one to work. How do i do this? r = new Regex("<\\s*img.*height=\"(?.*?)\".*width=\"(?.*?)\".*>", RegexOptions.IgnoreCase | RegexOptions.Compiled); thanks!! ;) Bruno Conde pharaoh

    L 1 Reply Last reply
    0
    • B brunoconde

      Hello!! I need to get the size of all images from an html page but i cant do one thing. Whith this expression i get only images where heigth and width come in this order. Ex: i can make only one to work. How do i do this? r = new Regex("<\\s*img.*height=\"(?.*?)\".*width=\"(?.*?)\".*>", RegexOptions.IgnoreCase | RegexOptions.Compiled); thanks!! ;) Bruno Conde pharaoh

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

      r = new Regex(@"[^"]+)"?\s+width="?(?[^"]+)|width="?(?[^"]+)"?\s+height="?(?[^"]+)).*>") This works fine for me :) Remember you can put an "@"-sign in front of your string declaration, so you don't need to escape certain characters. This comes in very handy with regular expressions. regards

      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