Page 1 of 1

how to find string using wild card?

Posted: Tue Feb 08, 2011 12:08 am
by adeam
Hi,

I am new and would like to know how can I find in the field using a wild cards, such as * or ?. (In other program, * is equivalent to any characters or number in any numbers and ? is equivalent to any char or number for 1 character.)

For example, I would like to find string in field Filenames ending with -en.doc or docx under any subfolder name. My command is shown below but I believe, it is not correct.

Code: Select all

find string "/*/*-en.doc?" in field "Filenames"


What would be the right command?

Thank you.

Re: how to find string using wild card?

Posted: Tue Feb 08, 2011 9:00 am
by jmburnod
Hi adeam,
You can use the filter command
Something like that

Code: Select all

on getStringEnding
   put fld "filenames" into tCont
   put ".doc,.docx" into theEnding
   repeat for each item MyEnding in theEnding
      put tCont into tCont2
      put "*"&MyEnding into MyFilter
      filter tCont2 with MyFilter
      put tCont2&return  after tFound
   end repeat
   put tFound 
end getStringEnding
Best
Jean-Marc

Re: how to find string using wild card?

Posted: Thu Feb 17, 2011 4:09 pm
by adeam
Thanks Jean-Marc. I was away for quite sometime and almost forgot what I post. But now, I'm back. :D Thanks again.

Re: how to find string using wild card?

Posted: Thu Feb 17, 2011 5:09 pm
by jmburnod
Hi Adeam,

Congratulation you can live without Livecode :wink:

Jean-Marc

Re: how to find string using wild card?

Posted: Thu Feb 17, 2011 6:48 pm
by BvG
A more powerful command is the matchChunk, giving you almost full regexp.

Re: how to find string using wild card?

Posted: Wed Mar 28, 2012 5:12 am
by Linh
Thanks BvG, matchChunk is really nice.