Regex start/end position of match?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 1 07:05:59 PDT 2015


On Thursday, 1 October 2015 at 03:29:29 UTC, Gerald wrote:
> I'm stuck though on how to get the start/end index of a match?

I couldn't find one either so I did the pre/post/hit things 
broken up.

Take a look at this little program I wrote:

http://arsdnet.net/dcode/replacer/

All the files it needs are there, so you can browse by http or 
download them somewhere and compile+run to give it a try.

Lines 73-78 show the pre/hit/post thing, with me changing the 
colors of the output so they match.

Afterward, I replace one instance and draw it again to show what 
the new line would look like. (The point of my program is to 
interactively request confirmation of every individual change you 
are going to make.)


Something similar will probably work for you too.


More information about the Digitalmars-d-learn mailing list