use of regex

Jesse Phillips jessekphillips+D at
Sun Jan 9 15:16:43 PST 2011

spir Wrote:

> Hello,
> After getting a MatchResult by calling match(source, engine): Seems that, if match has failed, calling result.hit() throws an assertion error. Then, how can I know whether match was successful? As there is always a matchResult object returned. I'm looking for a kind of success.failure flag on the matchResult.
> Note: this is for single match at start of source.

You'll want to use:


where m is your RegexMatch instance.

> I found this strange thingie in the online docs:
> struct RegexMatch(Range = string);
> 	...
> 	bool chr(ref uint si, E c);
>     	    Returns whether string s matches this.
> ???
> Whether string s (which?) matches this (RegexMatch object): ???
> And what are 'si' & 'c'?

File a bug.

More information about the Digitalmars-d-learn mailing list