Wow, brilliant! I didn't know about REFind's 4th attribute.

You've helped me before, and you helped me again.

Thanks,
Jamie

On Fri, 30 Mar 2001 15:26:40 -0500, in cf-talk you wrote:

>To get a backreference in a REFind() you have to set the 4th attribute of
>the function to true. Your function would then look like
>sReference=REFind('(before)(HeresTheStringIWant)(after)',
>myTargetString,1,1);
>which says find the pattern in myTargetString starting with position 1 and
>returning backreferences.
>If it succedes, you will have a structure called sReferencethat contains 2
>keys (pos and len). Each key is an array which contains the position (pos)
>and length (len) of the data you want. Array element 1 is the entire pattern
>return, element 2 is the first back reference, etc.
>To get the second back reference use this:
>Mid(myTargetString, sReference.pos[3], sReference.len[3])
>
>> Hi,
>>
>> Is there a way to do this sort of thing?
>>
>> <cfscript>
>> REFind("(before)(HeresTheStringIWant)(after)", myTargetString);
>> variables.foundstring = \2;
>> </cfscript>
>>
>> If not, what's the usual way to go about it? Seems like it could get
>> pretty ugly if there isn't a similar way.
>>
>> Thanks,
>> Jamie
>>
>>
>>
>>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to