[Bug libstdc++/71500] regex::icase only works on first character in a range

mwd at md5i dot com gcc-bugzilla@gcc.gnu.org
Sat Jun 11 14:46:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71500

--- Comment #3 from Michael Duggan <mwd at md5i dot com> ---
Still fails for the following code:

#include <iostream>
#include <regex>
#include <string>

using namespace std;

void check(const string& s, regex re) {
    cout << s << " : " << (regex_match(s, re) ? "Match" : "Nope") << endl;
}

int main() {
    regex re1 = regex("[T-f]+", regex::icase);
    check("aaa", re1);          /* expect match */
    check("AAA", re1);          /* expect match */
    check("fff", re1);          /* expect match */
    check("FFF", re1);          /* expect match */
    check("ttt", re1);          /* expect match */
    check("TTT", re1);          /* expect match */
    check("uuu", re1);          /* expect match */
    check("UUU", re1);          /* expect match */
    check("ggg", re1);          /* expect no match */
    check("GGG", re1);          /* expect no match */
}

Current output:

aaa : Nope
AAA : Nope
fff : Nope
FFF : Nope
ttt : Nope
TTT : Nope
uuu : Nope
UUU : Nope
ggg : Nope
GGG : Nope


More information about the Gcc-bugs mailing list