wxRegEx does not work properly?!?!?

Nusret Taşçı nusi at sofha.de
Wed Aug 30 07:41:55 PDT 2006


> static wxRegEx cookieRegEx(wxT("^[^@]*@\([^@]\+\)@"));
> or
> wxRegEx cookieRegEx(wxT("^[^@]*@\([^@]\+\)@"));

> but it does not work if i typing it MANUALLY during code execution... 

I think, what Michael wants to say is that the backslashes make the 
difference.

wxString s1 = wxT("^[^@]*@\([^@]\+\)@");
wxString s2 = wxT("^[^@]*@([^@]+)@");

wxASSERT(s1 == s2); // doesn't assert

When you type that manually, than do you type following?
^[^@]*@\([^@]\+\)@

This equals (in C/C++ syntax) to following:
wxT("^[^@]*@\\([^@]\\+\\)@");

Please be aware that the first backslash in such strings is an escape 
character which is handled by the compiler.


Nusi




More information about the wx-users mailing list