hyperlink regular expression pattern

novice2 sorry at noem.ail
Fri May 9 04:49:10 PDT 2008


> Perhaps someone's got a better pattern they could post?

this works for me (dmd 1.029)

import std.regexp;

void main()
{
 if (auto m = std.regexp.search(
              "<a href=\"www.google.com:8080/dfs?a1=1&a2=2\">This is Google link</a>",
              "<a[^>]+href=(['\"]?)(.*?)\\1.*?>(.*)</a>"))
 {
   for(int i=0; i<10; i++)
   {
     printf("%d=\"%.*s\"\n", i, m.match(i));
   }
 }
}



More information about the Digitalmars-d-learn mailing list