From: Fabian Cenedese on 1 Feb 2008 02:32 At 18:35 30.01.2008 +0100, Zorro wrote: >> wxString text; >> wxRegEx reEmail = wxT("([^@]+)@([[:alnum:].-_].)+([[:alnum:]]+)"); >> >> if ( reEmail.Matches(text) ) { // <---!!! >> wxString text = reEmail.GetMatch(email); >> ... >> >> You need to call Matches() before GetMatch(). > >ok , what is email? wxString regex or flag? > > >I need get substring and count (GetMatchCount) of substrings. >Please wrote simple example You can look at the example yourself: http://www.wxwindows.org/manuals/stable/wx_wxregex.html#wxregex But I think there's a small error in it. I think it should be: wxString email("someaddress(a)example.com"); wxRegEx reEmail = wxT("([^@]+)@([[:alnum:].-_].)+([[:alnum:]]+)"); if ( reEmail.Matches(email) ) { wxString text = reEmail.GetMatch(email); // whole address wxString username = reEmail.GetMatch(email, 1); wxString domain = reEmail.GetMatch(email, 2); wxString tld = reEmail.GetMatch(email, 3); .... bye Fabi --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
First
|
Prev
|
Pages: 1 2 Prev: How to manage combo box drop-down size? Next: Compiling with wxMSW2.8.4 DLL-Release |