Skip to content

[[:blank:]] does not just match [ \t] #533

@kennytm

Description

@kennytm

Both the docs of regex 1.0.5 and regex-syntax 0.6.2 suggests that [[:blank:]] is equivalent to [ \t], but it is actually wrong as shown in the test program below:

extern crate regex; // 1.0.5

fn main() {
    let r = regex::Regex::new("[[:blank:]]").unwrap();
    assert!(!r.is_match("\u{17}")); // unexpectedly panicked
}

I believe the error is due to

Blank => {
const X: T = &[(' ', '\t')];
X
}

line 1043 should read

 const X: T = &[('\t', '\t'), (' ', ' ')];

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions