You could use something like this:

<cfset str = '({name1}/365.25)*(datediff({name2},{name3}))' />

<cfset match = reFindNoCase("datediff\({([^}]*)},{([^}]*)}\)", str, 1, true)
/>

<cfset name2 = mid(str, match.pos[2], match.len[2]) />
<cfset name3 = mid(str, match.pos[3], match.len[3]) />

HTH,
-Dain

On Mon, Feb 21, 2011 at 12:32 PM, Richard White <[email protected]> wrote:

>
> hi, what if I had a string such as:
>
> <cfset str = '({name1}/365.25)*(datediff({name2},{name3}))' />
>
> ... and wanted to only get the values enclosed in parenthesis that exist
> inside the datediff() part of the string? so effectively the returned array
> would include only {name2} and {name3}
>
> this must be possible with the rematch that you have already helped me
> with, but i cannot seem to understand how to change the regular expression
> to make it return these results
>
> thanks for the help
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342468
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to