From: Fabian Cenedese on
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