Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Regex and multiple word search
Message
De
09/07/2009 09:33:33
 
 
À
09/07/2009 07:49:54
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01411109
Message ID:
01411141
Vues:
30
This is from my memory, this solution is very clean and easy to implement. And it really works...!
lcTextToFind='mouse trap living toom'
lcWord=GetWordNum(lcTextToFind,1)
Select * from yourtable where lcWord$yourfield into cursor curdummy readwrite 
if _tally>0 and GetWordCount(lcTextToFind)>1
   For lnX=2 to GetWordCount(lcTextToFind)
      lcWord=GetWordNum(lcTextToFind,lnX)
      Select * from curDummy where lcWord$yourfield into cursor curdummy readwrite
   EndFor 
EndIf
>given that activity is a c(100) field in a table
>
>what is the bst way to find records where severeal words are present but not necessarily together
>
>eg:
>
>mouse+trap+living room
>i want to find all occurances where 'mouse' is existing as well 'trap' and 'living room'
>at the moment i have something like
>'mouse'$activity and 'trap'$ activity and 'living room'$activity
>
>which is kind of cumbersome once there are more than 3 phrases
>I hope there is a way to do that with regex???
>
>
>Thnaks
>
>
>Peter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform