Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AT() but whole word only
Message
From
02/07/2008 08:09:25
 
 
To
02/07/2008 08:03:22
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01328188
Message ID:
01328189
Views:
16
This message has been marked as the solution to the initial question of the thread.
>is there a way to look for a word in a memo field text but only find whole words.
>eg: looking for KING should finf Martin Luther King but not lurking
>even if KING is at the beginning of a line or sentence or at the end therof.
>
>maybe REGEX could work, but how
>
>
>Peter
&& the \b matches a word boundary
	local obj
	obj = createobject('VBScript.RegExp')
	obj.Global = FALSE
	obj.IgnoreCase = TRUE
	obj.Pattern = '\bking\b'
	
	?obj.Test('king and I')  && TRUE
	?obj.Test('kingsolomon and I') && FALSE
	
	return 
see also: http://msdn.microsoft.com/en-us/library/ms974570.aspx
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform