RegEx
Fabian Cenedese
Cenedese at indel.ch
Wed Jan 30 05:34:54 PST 2008
At 14:18 30.01.2008 +0100, Zorro wrote:
>Fabian Cenedese pisze:
>> At 13:45 30.01.2008 +0100, Zorro wrote:
>>
>>> why my program not work?
>>>
>>> wxString x = "Hello";
>>> wxString y = "world";
>>> wxString n = "123";
>>> wxRegEx *r = new wxRegEx("e[a-z]*o");
>>> wxRegEx r2("/[a-z]*/");
>>>
>>> wxPrintf(_("regex [%s]\n"),r->GetMatch(x).mb_str());
>>>
>>> I would like to get "ello"
>>
>> Look at the help of wxRegEx. You need Compile(), Matches(), GetMatch().
>
>I get this from example ;(
Then look again. The example in my help looks like this:
wxString text;
wxRegEx reEmail = wxT("([^@]+)@([[:alnum:].-_].)+([[:alnum:]]+)");
if ( reEmail.Matches(text) ) { // <---!!!
wxString text = reEmail.GetMatch(email);
...
You need to call Matches() before GetMatch().
bye Fabi
More information about the wx-users
mailing list