Re: Regular Expression String search/match
- From: AK_2009 <ak.shopping.2008@xxxxxxxxx>
- Date: Wed, 11 Feb 2009 23:40:52 -0800 (PST)
On Feb 11, 8:39 pm, CBFalconer <cbfalco...@xxxxxxxxx> wrote:
I am trying to solve one Computer Science problem. One list has
16k strings which will have strings with wild card character "*"
at the beginning or at the end of few of the strings. I want to
search efficiently one string out of these 16 strings. Since this
list has strings with wild card, it looks some how complicated to
have very efficient approach. Please let me know if you guys have
some ideas. Also can we use RegEx functions of Posix LIB.
I gather the wild card can be at either end, but not in the
middle. If at the start, start the comparison from the back end of
the string. If at the end, start the comparison at the front end.
If neither '*' exists, just do a normal comparison.
[mail]: Chuck F (cbfalconer at maineline dot net)
Try the download section.
The wild card could be either at the start, at the end or even at
both:start+end. So strings could be: abc, abc*, *abc, *abc*.
The 3 cases are easier to handle, but the last case which has wild
cards at both the ends i.e. *abc* looks somehow difficult. Do you
have any suggestions, please?