Re: Regex help with search strings

2007-07-26 Thread Ben Doom
You could do this with a regex but it would be easier and more efficient 
to do it with listfind() using a space as the delimiter.

--Ben Doom

Mark Henderson wrote:
> Hi
>  
> I have a search box that currently contains only one field. I normally
> have one input for first name, one for lat name and so on, which makes
> the task of searching somewhat easier. However, in this scenario that is
> not the case. So, what I want to do is split the search term entered
> into distinct variables.
>  
> An example - let's say someone enters "joe blogs" in the search field
> (without quotes). I then want to be able to parse it so that I have one
> variable for "joe" and another for "blogs", which I can then search on
> since the database is organised into first_name, last_name, maiden_name,
> email, etc. The criteria for this will be the space between the names.
> This looks like a case for regular expressions. I know how to use REFind
> to check for the space, but that's all so far (I've spent some time on
> this, and even read the docs!). Can someone help me here please? 
>  
> TIA
> 
> Regards
> 
> Mark Henderson
> Web Designer
> mailto: [EMAIL PROTECTED]   
> 
> 205 Main Street
> PO Box 143, Gore
> Southland 9700
> Phone: (03) 203 
> Fax: (03) 203 9900
> 
> 
> 
>     
>    
>    
> 
> http://www.cwc.co.nz  
> http://www.ispnz.co.nz  
> http://www.nzfarming.co.nz   
> 
> 
> 
> Notice of Confidential Information: The information contained in this
> electronic mail is CONFIDENTIAL INFORMATION and may be LEGALLY
> PRIVILEGED, intended only for the individual or entity named above. If
> you are not the intended recipient, you are hereby notified that the
> use, dissemination, distribution, or copying of this document is
> strictly prohibited. If you have received this electronic message in
> error, please immediately notify us by return or telephone (0064 3 203
> ) and destroy the original message. Thank you. 
> 
> 


~|
ColdFusion 8 beta - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284631
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Regex help with search strings

2007-07-26 Thread Jide Aliu
>From what you're saying, you probably might not need Regex. How about 
>GetToken? 






Am I barking up the wrong tree?


~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284675
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Regex help with search strings

2007-07-26 Thread Bobby Hartsfield
My brother's name is Justin William Eugene Mckinney III. That might throw
you for a loop. It will really throw you for a loop when it is 
"Justin William Eugene Mckinney III PHD"
Or
"Dr. Justin William Eugene Mckinney III"

Simply taking listfirst() and listlast() delimited by a space won't always
give you the result you want... but when it IS a good idea... you just do...




..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com

-Original Message-
From: Mark Henderson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 25, 2007 6:19 PM
To: CF-Talk
Subject: Regex help with search strings

Hi
 
I have a search box that currently contains only one field. I normally have
one input for first name, one for lat name and so on, which makes the task
of searching somewhat easier. However, in this scenario that is not the
case. So, what I want to do is split the search term entered into distinct
variables.
 
An example - let's say someone enters "joe blogs" in the search field
(without quotes). I then want to be able to parse it so that I have one
variable for "joe" and another for "blogs", which I can then search on since
the database is organised into first_name, last_name, maiden_name, email,
etc. The criteria for this will be the space between the names.
This looks like a case for regular expressions. I know how to use REFind to
check for the space, but that's all so far (I've spent some time on this,
and even read the docs!). Can someone help me here please? 
 
TIA

Regards

Mark Henderson
Web Designer
mailto: [EMAIL PROTECTED]   

205 Main Street
PO Box 143, Gore
Southland 9700
Phone: (03) 203 
Fax: (03) 203 9900



  
  
   

http://www.cwc.co.nz  http://www.ispnz.co.nz
 http://www.nzfarming.co.nz
  



Notice of Confidential Information: The information contained in this
electronic mail is CONFIDENTIAL INFORMATION and may be LEGALLY PRIVILEGED,
intended only for the individual or entity named above. If you are not the
intended recipient, you are hereby notified that the use, dissemination,
distribution, or copying of this document is strictly prohibited. If you
have received this electronic message in error, please immediately notify us
by return or telephone (0064 3 203
) and destroy the original message. Thank you. 


--
This message has been scanned for viruses and dangerous content by ISPNZ's
automated virus detection system, and is believed to be clean.





~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284682
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Regex help with search strings

2007-07-26 Thread Mark Henderson
> From: Ben Doom
> Sent: Friday, 27 July 2007 2:17 a.m.
> To: CF-Talk
> Subject: Re: Regex help with search strings
> 
> You could do this with a regex but it would be easier and 
> more efficient to do it with listfind() using a space as the 
> delimiter.

Hi Ben. 

I worked it out using a regex but I see why you recommend using listfind
given the logic required in the search query when using more than one
variable. So I took your advice and read:
http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt210.ht
m#4695870

... and I have it working with that now. Thanks for the tip.

Mark

-- 
This message has been scanned for viruses and dangerous
content by ISPNZ's automated virus detection system,
and is believed to be clean.


~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284677
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Regex help with search strings

2007-07-26 Thread Mark Henderson
From: Mark Henderson 
> Sent: Thursday, 26 July 2007 10:19 a.m.
> To: CF-Talk
> Subject: Regex help with search strings
> 
> Hi
>  
> I have a search box that currently contains only one field. I 
> normally have one input for first name, one for lat name and 
> so on, which makes the task of searching somewhat easier. 
> However, in this scenario that is not the case. So, what I 
> want to do is split the search term entered into distinct variables.
>  
> An example - let's say someone enters "joe blogs" in the 
> search field (without quotes). I then want to be able to 
> parse it so that I have one variable for "joe" and another 
> for "blogs", which I can then search on since the database is 
> organised into first_name, last_name, maiden_name, email, 
> etc. The criteria for this will be the space between the names.
> This looks like a case for regular expressions. I know how to 
> use REFind to check for the space, but that's all so far 
> (I've spent some time on this, and even read the docs!). Can 
> someone help me here please? 

For some reason Outlook decided to try and send my previous post as HTML
when I have HOF clearly set in my address book to use plain text - my
apologies for that. Anyway, something like the following seems to work:




But if there is something else I can or should be doing when checking
the field please let me know.

Mark

-- 
This message has been scanned for viruses and dangerous
content by ISPNZ's automated virus detection system,
and is believed to be clean.


~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284678
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Regex help with search strings

2007-07-27 Thread Mark Henderson
Bobby Hartsfield wrote:
> My brother's name is Justin William Eugene Mckinney III. That 
> might throw you for a loop. It will really throw you for a 
> loop when it is "Justin William Eugene Mckinney III PHD"
> Or
> "Dr. Justin William Eugene Mckinney III"

Hi Bobby

Yep, I considered this type of thing and you are right, so for better or
worse on the search box view I am advising them to enter first and last
names only. And before the search is executed I am also doing:



And if it is greater than 1 I shoot them back with an error message
telling them they entered too many names. I'm also checking for numbers
and other characters.

> Simply taking listfirst() and listlast() delimited by a space 
> won't always give you the result you want... but when it IS a 
> good idea... you just do...
> 
>   listlast(name, " ") />

This is what I'm going with since it is simple and effective enough for
my requirements. Thanks!

then Jide Aliu wrote
> From what you're saying, you probably might not need Regex. 
> How about GetToken? 
> 
> 
> 
>   var2 = GetToken(trim(SearchField), 2, " ")>
> 
> Am I barking up the wrong tree?

Jide, no I don't think you are, but when I try this it returns a full
set of results in the database. It could be the way my search query
logic is ordered, since when I output var1 and var2, they appear to be
correct. However, I had some success with listfind and also with Bobby's
suggestion above (which is what I'm using), so I didn't delve into it
too much.

I'm still getting some delay on the HOF mail delivery, so thanks to all
who replied.

Mark

-- 
This message has been scanned for viruses and dangerous
content by ISPNZ's automated virus detection system,
and is believed to be clean.


~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284691
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4