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.