From: Zorro on
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 lige to get "ello"
From: Fabian Cenedese on
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 lige to get "ello"

Look at the help of wxRegEx. You need Compile(), Matches(), GetMatch().

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

From: Zorro on
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 ;(

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



---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: Zorro on
> 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