Can I take a string like this:
xxx [EMAIL PROTECTED] yyy [EMAIL PROTECTED] zzz [EMAIL PROTECTED]
And use the returnsubexpressions option to return the start and
length of each email address?
I'm using this code (lifted from the net):
<cfset myString="xxx [EMAIL PROTECTED] yyy [EMAIL PROTECTED] zzz [EMAIL
PROTECTED]">
<cfset
sLenPos=REFindNoCase("^[a-zA-Z]([.]?([[:alnum:]_-]+)*)?@([[:alnum:]\-_]+\.)+[a-zA-Z]{2,4}$",
myString, 1, "True")>
<cfoutput>
#sLenPos.pos[1]# #mid(myString, sLenPos.pos[1], sLenPos.len[1])#<br>
</cfoutput>
<cfset newstart = sLenPos.pos[1] + sLenPos.len[1] - 1>
<!--- subtract 1 because you need to start at the first space --->
<cfset
sLenPos=REFindNoCase("^[a-zA-Z]([.]?([[:alnum:]_-]+)*)?@([[:alnum:]\-_]+\.)+[a-zA-Z]{2,4}$",
myString, newstart, "True")>
<cfoutput>
#sLenPos.pos[1]# #mid(myString, sLenPos.pos[1], sLenPos.len[1])#<br>
</cfoutput><br>
When I try it, it doesn't find anything. When I use "@test.com" in
place of the the email regex, it works. So it must be something to
do with the email regex. I'm using CF5 in this instance. Any help
would be greatly appreciated.
T
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:21:951
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54