How about this:

<cfset myString1 = "name=""firstname"" method=">
<cfset myString2 = "name=firstname method=">
<cfoutput>#myString1#<br>#myString2#<br /> </cfoutput>
<cfset foundit1 = ReFindNoCase("(name)(\W+)(\w+)\b",myString1,1,true)>
<cfset foundit2 = ReFindNoCase("(name)(\W+)(\w+)\b",myString2,1,true)>
<cfoutput>
#Mid(myString1,foundit1.pos[4],foundit1.len[4])#<br>
#Mid(myString2,foundit2.pos[4],foundit2.len[4])#<br>
</cfoutput>

I don't know of a way to extract a substring from a regular expression,
but if you use the return subexpressions = true option, you can use
other functions like Mid to extract the desired string from the
original.

> -----Original Message-----
> From: Emmet McGovern [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 19, 2005 3:06 PM
> To: CF-Talk
> Subject: RE: Regex help.
> 
> That will just return the position of the start of name= not 
> the actual
> formfield name.  I need the formfield name.
> 
> Thanks.
> 
> -----Original Message-----
> From: Munson, Jacob [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 19, 2005 4:42 PM
> To: CF-Talk
> Subject: RE: Regex help.
> 
> This should work:
> ReFind("(name)(=|"")(.*?)\b",myString,1,false) 
> 
> > -----Original Message-----
> > From: Emmet McGovern [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, October 19, 2005 2:32 PM
> > To: CF-Talk
> > Subject: Regex help.
> > 
> > I need to get formfield names from a plain html doc loaded as 
> > a string.
> > 
> > Does anyone with a better grasp of regex know an efficient 
> > way to get the
> > value of a name of a formfield. (ie name="firstname" returns 
> > firstname) also
> > taking into consideration variances such as name=firstname. 
> > 
> > Thanks,
> > Emmet
> 
> This transmission may contain information that is privileged, 
> confidential
> and/or exempt from disclosure under applicable law. If you are not the
> intended recipient, you are hereby notified that any 
> disclosure, copying,
> distribution, or use of the information contained herein 
> (including any
> reliance thereon) is STRICTLY PROHIBITED. If you received 
> this transmission
> in error, please immediately contact the sender and destroy 
> the material in
> its entirety, whether in electronic or hard copy format. 
> Thank you. A1.
> 
> 
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221567
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to