App crash when i'm using "std::regex"

my application will cash after i use std::regex in it, but it’s okay run on win32 platform.

that’s code.

void CLoginLayer::editBoxEditingDidEnd(cocos2d::extension::EditBox* editBox)
{
    std::regex emailPattern("([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)");
    std::regex pwdPattern("[a-zA-Z0-9]{6,15}");
    std::string strEditboxValue = editBox->getText();

    switch (editBox->getTag())
    {
    case EmTagEditbox::emEmailAdd:
        if ( ! std::regex_match( strEditboxValue, emailPattern ) )
        {
            ShowMsg("Wrong format of email.");
            editBox->setText("");
        }
        break;
    case EmTagEditbox::emPwd:
        if ( ! std::regex_match( strEditboxValue, pwdPattern ) )
        {
            ShowMsg("Wrong format of password.");
            editBox->setText("");
        }
        break;
    default:
        break;
    }

the app crash after i finish input of the editbox…

On which platform it crashes? Which libstdc**/libc** version you’re using? Regex library is just a stub in older libstdc++ versions, so avoid using it with android NDK.

Sergey Shambir wrote:

On which platform it crashes? Which libstdc**/libc** version you’re using? Regex library is just a stub in older libstdc*+ versions, so avoid using it with android NDK.
c*+11, cocos2dx 3.0.

Alternatively, if you aren’t restricted to using c++'s std::regex, you could try using standard C: regcomp() and regexec() .

Here a sample implementation http://pubs.opengroup.org/onlinepubs/009695399/functions/regcomp.html :

#include <regex.h>

int match(const char *string, const char *pattern)
{
    int    status;
    regex_t    re;


    if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0) {
        return(0);      /* Report error. */
    }
    status = regexec(&re, string, (size_t) 0, NULL, 0);
    regfree(&re);
    if (status != 0) {
        return(0);      /* Report error. */
    }
    return(1);
}

Excuse me, are you solved this problem