[draft] New std.regex walkthrough

Nick Sabalausky a at a.a
Tue Mar 13 12:42:18 PDT 2012


"Dmitry Olshansky" <dmitry.olsh at gmail.com> wrote in message 
news:jjo73v$4gv$1 at digitalmars.com...
> For a couple of releases we have a new revamped std.regex, that as far as 
> I'm concerned works nicely, thanks to my GSOC commitment last summer. Yet 
> there was certain dark trend around std.regex/std.regexp as both had 
> severe bugs, missing documentation and what not, enough to consider them 
> unusable or dismiss prematurely.
>
> It's about time to break this gloomy aura, and show that std.regex is 
> actually easy to use, that it does the thing and has some nice extras.
>
> Link: http://blackwhale.github.com/regular-expression.html
>
> Comments are welcome from experts and newbies alike, in fact it should 
> encourage people to try out a few tricks ;)
>
> This is intended as replacement for an article on dlang.org
> about outdated (and soon to disappear) std.regexp:
> http://dlang.org/regular-expression.html
>
> [Spoiler] one example relies on a parser bug being fixed (blush):
> https://github.com/D-Programming-Language/phobos/pull/481
> Well, it was a specific lookahead inside lookaround so that's not severe 
> bug ;)
>
> P.S. I've been following through a bunch of new bug reports recently, 
> thanks to everyone involved :)
>

Looks nice at an initial glance through. Few things I'll point out though:

- The bullet-list immediately after the text "Now, come to think of it, this 
tiny sample showed a lot of useful things already:" looks like it's 
outdented instead of indented. Just kinda looks a little odd.

- Speaking of the same line, I'd omit the "Now, come to think of it" part. 
It sounds too "stream-of-conciousness" and not very "professional article".

- I'm very much in favor of using backticked strings for regexes instead of 
r"", because with the latter, you can't include double-quotes, which I'd 
think would be a much more common need in a regex than a backtick. Although 
I understand that backticks aren't easy to make on some keyboards. (In the 
US layout I have, it's just an unshifted tilde, ie, the key just to the left 
of "1". I guess some people don't have a backtick key though?)




More information about the Digitalmars-d mailing list