digitalmars.D.learn - use of regex
- spir (19/19) Jan 09 2011 Hello,
- Jesse Phillips (5/19) Jan 09 2011 You'll want to use:
Hello,
After getting a MatchResult by calling match(source, engine): Seems that, i=
f match has failed, calling result.hit() throws an assertion error. Then, h=
ow can I know whether match was successful? As there is always a matchResul=
t object returned. I'm looking for a kind of success.failure flag on the ma=
tchResult.
Note: this is for single match at start of source.
I found this strange thingie in the online docs:
struct RegexMatch(Range =3D 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'?
Denis
-- -- -- -- -- -- --
vit esse estrany =E2=98=A3
spir.wikidot.com
Jan 09 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: if(!m.empty) 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.
Jan 09 2011








Jesse Phillips <jessekphillips+D gmail.com>