From: Zorro on 31 Jan 2008 07:45 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 31 Jan 2008 08:00 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 31 Jan 2008 08:18 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 31 Jan 2008 08:34 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 31 Jan 2008 12:35 > 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
|
Next
|
Last
Pages: 1 2 Prev: How to manage combo box drop-down size? Next: Compiling with wxMSW2.8.4 DLL-Release |