Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kennytm opened this issue Oct 26, 2018 · 0 comments
Closed

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

kennytm opened this issue Oct 26, 2018 · 0 comments
Labels

Comments

@kennytm
Copy link
Member

kennytm commented Oct 26, 2018

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'), (' ', ' ')];
kennytm added a commit to kennytm/regex that referenced this issue Oct 27, 2018
@BurntSushi BurntSushi added the bug label Oct 29, 2018
BurntSushi pushed a commit that referenced this issue Oct 29, 2018
Ensure `[[:blank:]]` only matches `[ \t]`. It appears that there was
a transcription error when `regex-syntax` was rewritten such that
`[[:blank:]]` ended up matching more than it was supposed to.

Fixes #533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants