Restrictions in std.regexp?
    Olaf Pohlmann 
    op at nospam.org
       
    Tue May  2 08:39:45 PDT 2006
    
    
  
Derek Parnell wrote:
>     RegExp re = search("ABCDEF", "(AB)?(CD)(EF)?");
Oops, this is actually very close to the solution, just drop both '?'. 
It's even more readable than what I tried before:
import std.stdio;
import std.regexp;
void main()
{
     char[] html = "<body>\n<h1>Welcome</h1>\n</body>";
	RegExp re = search(html, r"(\<h1\>)(.*?)(\</h1\>)");
	if (re !is null)
		writefln("%s", re.match(2));
}
op
    
    
More information about the Digitalmars-d-learn
mailing list