Return to Snippet

Revision: 11021
at January 21, 2009 07:45 by leonbda

Initial Code
using System.Text.RegularExpressions;

//looking for photo paths with REGX-a
        string nl = // in this case page html.
        MatchCollection mc = null;
        string sRegExp = "src=(?:\"|\')?(?<imgSrc>[^>]*[^/].(?:jpg|bmp|gif|png))(?:\"|\')?";
        mc = Regex.Matches(nl, sRegExp);

        string[] path;
        for (int j = 0; j < mc.Count; j++)
            path = mc[j].Value.Split('"');
            Response.Write(path[1].ToString().Trim() + "<br />");

Initial URL

Initial Description
In this case I'm looking for image sources in html and placing them in array.

Initial Title
Parse html via RegularExpression and place results in Array

Initial Tags
path, array

Initial Language