Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why don character ranges work properly (POSIX mode only)?

0
Posted

Why don character ranges work properly (POSIX mode only)?

0

A. The POSIX standard specifies that character range expressions are locale sensitive – so for example the expression [A-Z] will match any collating element that collates between ‘A’ and ‘Z’. That means that for most locales other than “C” or “POSIX”, [A-Z] would match the single character ‘t’ for example, which is not what most people expect – or at least not what most people have come to expect from regular expression engines. For this reason, the default behaviour of Boost.Regex (perl mode) is to turn locale sensitive collation off by not setting the regex_constants::collate compile time flag. However if you set a non-default compile time flag – for example regex_constants::extended or regex_constants::basic, then locale dependent collation will be enabled, this also applies to the POSIX API functions which use either regex_constants::extended or regex_constants::basic internally. [Note – when regex_constants::nocollate in effect, the library behaves “as if” the LC_COLLATE locale ca

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123