[Issue 17212] New: std.regex doesn't ignore whitespace after character classes, even when compiling with "x"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 20 12:37:15 PST 2017


https://issues.dlang.org/show_bug.cgi?id=17212

          Issue ID: 17212
           Summary: std.regex doesn't ignore whitespace after character
                    classes, even when compiling with "x"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: markus.laker at gmail.com

Even when compiled with the "x" flag, a regex does not ignore whitespace in a
pattern immediately after a character class:

msl at 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 at james:~/d$ ./test3.d 'a', ' a '
true
msl at james:~/d$ ./test3.d 'a', ' [a] '
false
msl at james:~/d$ ./test3.d 'a ', ' [a] '
true
msl at 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.

--


More information about the Digitalmars-d-bugs mailing list