Heh, you're not going to get anything so nice as Perl string handling.

<cfscript>
str = "foo123bar" ;
found = reFind("foo([[:digit:]]+)bar", str, 1, true) ;
sub_str = mid(str, found.pos[2], found.len[2]) ;
</cfscript>

The last argument of the reFind() is 'return sub expressions', in this case
it's true. When true, the var 'found' is a struct containing two arrays: POS
is a return of all the starting positions of the expression (1 is full
string match), and LEN is an array of lenghts of the substrings matching the
POS.

Backreferencing is avail. in reReplace() though for when you want to replace
substrings.

-----Original Message-----
From: Jamie Jackson [mailto:[EMAIL PROTECTED]]
Sent: March 30, 2001 11:50
To: CF-Talk
Subject: Back-referencing after a REFind to set a variable?


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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to