Bug 17212 – std.regex doesn't ignore whitespace after character classes, even when compiling with "x"

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-02-20T20:37:00Z
Last change time
2017-03-05T05:38:11Z
Keywords
pull
Assigned to
nobody
Creator
markus.laker

Comments

Comment #0 by markus.laker — 2017-02-20T20:37:15Z
Even when compiled with the "x" flag, a regex does not ignore whitespace in a pattern immediately after a character class: msl@james:~/d$ cat test3.d #!/usr/bin/rdmd import std.regex, std.stdio; void main(in string[] args) { auto rx = regex(args[2], "x"); writeln(!!args[1].matchFirst(rx)); } msl@james:~/d$ ./test3.d 'a', ' a ' true msl@james:~/d$ ./test3.d 'a', ' [a] ' false msl@james:~/d$ ./test3.d 'a ', ' [a] ' true msl@james:~/d$ The bug is present in 2.073.1 but was not present in 2.071. I'll download some intermediate releases and try to narrow it down more precisely.
Comment #1 by markus.laker — 2017-02-20T21:14:38Z
The bug seems to have been introduced in 2.072.0.
Comment #2 by dmitry.olsh — 2017-02-20T22:34:35Z
Comment #3 by github-bugzilla — 2017-02-21T01:11:03Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/62cf615dda64274c4f07b2c92a008baa132073ac Fix issue 17212 std.regex doesn't ignore whitespace after character classes https://github.com/dlang/phobos/commit/694dd1743f4fb627f04d52723228d1ef99c5fcac Merge pull request #5167 from DmitryOlshansky/fix-freeform-regex Fix issue 17212 std.regex doesn't ignore whitespace after character c…
Comment #4 by github-bugzilla — 2017-03-05T05:38:11Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/62cf615dda64274c4f07b2c92a008baa132073ac Fix issue 17212 std.regex doesn't ignore whitespace after character classes https://github.com/dlang/phobos/commit/694dd1743f4fb627f04d52723228d1ef99c5fcac Merge pull request #5167 from DmitryOlshansky/fix-freeform-regex