[draft] New std.regex walkthrough

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Mar 13 13:02:26 PDT 2012


On 13.03.2012 23:42, Nick Sabalausky wrote:
> "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".

Thanks, these are kind of things I intend to fix/improve/etc.
Hence the [draft] prefix.

>
> - 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?)
>

Same here, but I recall there is a movement (was it?) against backticked 
strings, including some of DPL's highly ranked members ;)
So I thought that maybe it's best to not impose my (perverted?) style on 
readers.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list