Underscore will not match propblaly
dbergloev opened this issue · 2 comments
Hi.
I tried making a simple regexp r"^[^\s\\/]+$" but for some reason this would not allow underscore when testing with is_match(). I tried changing the above to something like r"^[A-Za-z0-9\.-_]+$" just to test if this was somehow captured with \s for some reason, but I get the same result, is_match() returns false if the string contains any underscore characters.
For now the only solution that I came up with was to only test dashes using a temp testing string: let mystr_chk = mystr.replace("_", "-"). Since both are valid for my test and I don't need to know explicitly which ones are used, this works for this particular use case. But I thought still to report this for future fixes.
Damn, to fast on this. For some reason doing a cargo clean fixed this problem. Not sure what caused it, but it seams to be working now.
Odd. Also, in the future, definitely provide a complete Rust program demonstrating the issue. But I'm glad it's resolved.