Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/06/2010, 12:10
m3p
 
Fecha de Ingreso: noviembre-2009
Mensajes: 24
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Problemas con expresiones regulares

Ya lo resolvi...
Muchas gracias!

fue asi!

<cfset chain = form.numbers>

<CFSET listDNC = "">
<CFSET listBadNumbers = "">
<!--- Loop through list of numbers and clean it up --->
<!--- Loop over each record in the list. Separate by comma or new line characters --->
<CFLOOP list="#trim(chain)#" index="phoneNumber" delimiters=",#chr(13)##chr(10)#">
<CFSET tmpPhoneNumber = phoneNumber>

<!--- Remove any characters that aren't numbers --->
<CFSET tmpPhoneNumber = ReReplace(tmpPhoneNumber,"[^0-9]","","all")>
<!--- If first character is 1 or 0, remove it --->
<CFIF ListFind("0,1",Left(tmpPhoneNumber,1))>
<CFSET tmpPhoneNumber = mid(tmpPhoneNumber,2,Len(tmpPhoneNumber))>
</CFIF>

<!--- If there aren't 10 digits, the number is invalid. Add it to a list to display later. Else, add it to the DNC List --->
<CFIF NOT len(tmpPhoneNumber) IS 10>
<!--- Add phone number to list of clean numbers --->
<CFSET listBadNumbers = listAppend(listBadNumbers,phoneNumber) >
<CFELSE>
<!--- Add phone number to list of clean numbers --->
<CFSET listDNC = listAppend(listDNC,tmpPhoneNumber) >
</CFIF>
</CFLOOP>


<!--- To pass data into database, numbers need to be surrounded by single quotes --->
<CFSET listDNC = ListQualify(listDNC,"'")>