Regular Expression for images
-
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
-
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
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