digitalmars.D - Addition to RegExp class
- Derek Parnell (28/28) Sep 11 2005 Walter,
Walter,
I'd like to get the span of a match, rather than just its starting
position. Maybe you could add something like something like this to the
std.regexp module ...
alias regmatch_t re_span;
/*************************************************
* Search string for match.
* Returns:
* A re_span struct.
* .rm_so (int) Start position of match
* .rm_eo (int) Last position + 1 of match.
*/
public re_span find_span(rchar[] string)
{
static re_span nf = {-1,0};
if (test(string) != 0)
return pmatch[0];
else
return nf; // no match
}
--
Derek Parnell
(skype: derek.j.parnell)
Melbourne, Australia
Download BUILD from ...
http://www.dsource.org/projects/build/ v2.09 released 10/Aug/2005
http://www.prowiki.org/wiki4d/wiki.cgi?FrontPage
12/09/2005 1:56:57 PM
Sep 11 2005








Derek Parnell <derek psych.ward>