Bug 5523 – std.regex handles "\s" and "\W" (etc.) inside square brackets improperly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-02-03T19:05:00Z
Last change time
2012-02-26T11:01:36Z
Assigned to
nobody
Creator
lexlexlex

Comments

Comment #0 by lexlexlex — 2011-02-03T19:05:28Z
http://lex.clansfx.co.uk/projects/regexbugtest.d My workaround was to list all the characters \s is meant to match. Note that I have a bigger example of this bug if you're interested. Minimal example to avoid wasting your time: module main; import std.stdio,std.regex; void main() { //minimal regex; should match full "sec" but matches "s" instead //regextester.com handles it properly foreach(m; match("sec", regex(`([\s_]|sec)`, "gi"))) writefln("%s[%s]%s", m.pre, m.hit, m.post); return; }
Comment #1 by dmitry.olsh — 2012-02-26T11:01:36Z
Works since 2.057.