Thread: [Dev-C++] searching in array
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Lloyd <ll...@cd...> - 2007-07-18 08:23:27
|
Hi, I have an array of strings. I want to search in the array for a particular pattern. As an example let the content in the array be this thi this is hello t text hi If I give a search term like "t*" (something like regular expression) it must return this thi this is t text How can I accomplish this? Thanks and Regards, Lloyd ______________________________________ Scanned and protected by Email scanner |
|
From: Per W. <pw...@ia...> - 2007-07-18 08:25:57
|
The same way you would do it if you just have a single string. Just add a loop to iterate through all entries in the array and perform your pattern matching for each entry. /pwm On Wed, 18 Jul 2007, Lloyd wrote: > Hi, > I have an array of strings. I want to search in the array for a > particular pattern. As an example let the content in the array be > > this > thi > this is > hello > t > text > hi > > If I give a search term like "t*" (something like regular expression) it > must return > > this > thi > this is > t > text > > > How can I accomplish this? > > Thanks and Regards, > Lloyd > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Adam J. <aj...@i-...> - 2007-07-18 13:31:44
|
You should check out the Boost.Regex function. This allows you to do regular expression searches on strings. Here are two links you should check out: http://www.boost.org/libs/regex/doc/index.html http://www.onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html I hope this helps. -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Lloyd Sent: Wednesday, July 18, 2007 4:31 AM To: dev...@li... Subject: [Dev-C++] searching in array Hi, I have an array of strings. I want to search in the array for a particular pattern. As an example let the content in the array be this thi this is hello t text hi If I give a search term like "t*" (something like regular expression) it must return this thi this is t text How can I accomplish this? Thanks and Regards, Lloyd ______________________________________ Scanned and protected by Email scanner ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Adam J. <aj...@i-...> - 2007-07-19 01:48:45
|
No problem I am glad I could be of assistance. -Adam Jones -----Original Message----- From: Lloyd [mailto:ll...@cd...] Sent: Wednesday, July 18, 2007 10:44 AM To: Adam Jones Subject: Re: [Dev-C++] searching in array Thank you Adam, really it helps :) Regards, Lloyd On Wed, 2007-07-18 at 09:31 -0400, Adam Jones wrote: > You should check out the Boost.Regex function. This allows you to do regular > expression searches on strings. Here are two links you should check out: > > http://www.boost.org/libs/regex/doc/index.html > http://www.onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html > > I hope this helps. > > -Adam Jones > > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Lloyd > Sent: Wednesday, July 18, 2007 4:31 AM > To: dev...@li... > Subject: [Dev-C++] searching in array > > Hi, > I have an array of strings. I want to search in the array for a > particular pattern. As an example let the content in the array be > > this > thi > this is > hello > t > text > hi > > If I give a search term like "t*" (something like regular expression) it > must return > > this > thi > this is > t > text > > > How can I accomplish this? > > Thanks and Regards, > Lloyd > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ______________________________________ Scanned and protected by Email scanner |