>
> The SQL part we have. And I have a RegEx that works beautifully - but only
> if someone enters a phrase (in quotes).
>
> Our code is:
> <cfset my_reg_ex = "(?:""([^""]+)"")|([^ ]+) ">
> <cfset my_search_terms_array = REMatch (my_reg_ex, FORM.searchString)>
>
> .... then our SQL to loop over the array that REMatch creates.
>
> Any help on why the RegEx does NOT work (it always misses the last word in
> the FORM.searchString (i.e. our array is always one short!).
>


Works fine here - but do yourself a favour and don't use escaped
double-quotes... cfsavecontent makes it easier to read (or use single
quotes).

Here is the test code that works for me:

<cfsavecontent variable="Input1">"Healthy Children" Canada
Nutrition</cfsavecontent>
<cfsavecontent variable="Input2">Healthy Children Canada
Nutrition</cfsavecontent>
<cfsavecontent variable="Input3">Healthy Children "Canada
Nutrition"</cfsavecontent>
<cfsavecontent variable="Input4">"Healthy Children Canada
Nutrition"</cfsavecontent>
<cfsavecontent variable="Input5">"Healthy Children" "Canada
Nutrition"</cfsavecontent>

<cfsavecontent variable="Rex">(?:"([^"]+)")|([^ ]+)</cfsavecontent>

<cfdump var="#rematch( Rex , Input1 )#" />
<cfdump var="#rematch( Rex , Input2 )#" />
<cfdump var="#rematch( Rex , Input3 )#" />
<cfdump var="#rematch( Rex , Input4 )#"/>
<cfdump var="#rematch( Rex , Input5 )#"/>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/regex/message.cfm/messageid:1185
Subscription: http://www.houseoffusion.com/groups/regex/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to