www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17212] New: std.regex doesn't ignore whitespace after

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 puremagic.com
          Reporter: markus.laker gmail.com

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.

--
Feb 20