Boost C++ Libraries: Ticket #360: Regex https://svn.boost.org/trac10/ticket/360 <pre class="wiki">PROBLEM: ======== If I use the following code: lv_rcode = regcomp(&amp;lr_re, ms_RegExp, REG_EXTENDED); lv_rcode = regexec(&amp;lr_re, &amp;lv_string[0], 1, &amp;pm, 0); to find the following text: cm582172 Using the following regular expression [A-Z]{2}[[:space:]]*[0-9]{6}[[:space:]]* The text if found. However if I use instead the following code boost::regex regx(config.vRegx.at(iCnt).c_str()); flags = boost::match_default; boost::regex_search(start, end, what, regx, flags) With the same regular expression it does not find the string unless I use the following regular expression: [a-z]{2}[[:space:]]*[0-9]{6}[[:space:]]* The difference is the lower case of the alpha range [a-z] My question: Is there a way I can use regexec to be case sensitive for the alpha range like it is with regex_search function? Thanks, Matias </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/360 Trac 1.4.3 Daryle Walker Fri, 03 Aug 2007 11:53:06 GMT component changed; severity set https://svn.boost.org/trac10/ticket/360#comment:1 https://svn.boost.org/trac10/ticket/360#comment:1 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">regex</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket John Maddock Mon, 13 Aug 2007 18:25:36 GMT status, resolution, description changed https://svn.boost.org/trac10/ticket/360#comment:2 https://svn.boost.org/trac10/ticket/360#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">invalid</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/360?action=diff&amp;version=2">diff</a>) </li> </ul> <p> This occurs because by default POSIX regular expressions treat character ranges like [A-Z] as locale sensitive, and will match any character that collates within that range. For most locales the character "cm" do collate within that range, and hence they match. You can get more Perl-like behaviour by setting REG_NOCOLLATE as well as REG_EXTENDED when compiling the expression. </p> Ticket