List Info

Thread: CF5 and email regex




CF5 and email regex
user name
2006-06-20 01:27:38
Can I take a string like this:

xxx tsherrauracom.com yyy bobauracom.com zzz fredauracom.com

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 tsherrtest.com yyy bobtest.com
zzz fredtest.com">
<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/u
nsubscribe.cfm?user=22184.15789.21
Donations & Support: http://www.h
ouseoffusion.com/tiny.cfm/54
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )