Skip to content

Full case folding #262

@lmna

Description

@lmna

Case-insensitive matching in RE2 uses "simple" (as opposed to "full") Unicode case-folding.

RE2 documentation does not mention this aspect. User has to write a test to find it out.

Some other regex engines can do full case-folding (for instance, ICU and regex). It would be awesome if RE2 could do this too.

#include <re2/re2.h>
#include <gtest/gtest.h>

TEST(FullCaseFolding, FullCaseFolding)
{
	RE2::Options options;
	options.set_case_sensitive(false);

	EXPECT_TRUE(RE2::FullMatch("grüßen", RE2("GRÜSSEN", options)));
	EXPECT_TRUE(RE2::FullMatch("GRÜSSEN", RE2("grüßen", options)));
}

int main(int argc, char **argv) {
	::testing::InitGoogleTest(&argc, argv);
	return RUN_ALL_TESTS();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions