PRODUCT TYPE: Homeowners
CONTACT CAN BE REACHED AT:
Name: value, test Home: (555)555-1212
Address1: 123 Test Ln Work: (555)555-1212
Address2:
City/St/Zip: Wilmington, NC, 28412 Email:
wesley@mystateinsurance.com
County: New hanover
Contact Time: Anytime Respond Time: Within 24 hours
------------------------------------------------------------------------
This is what it looks like before I run the
<cfset noFormat =
ReReplace(emailBody,"[^A-Za-z0-9,:@.]+",'\1','all')>
after this is run the string looks like
PRODUCTTYPE:HomeownersCONTACTCANBEREACHEDAT:Name:value,testHome:5555551212Address1:123TestLnWork:5555551212Address2:City/St/Zip:Wilmington,NC,28412Email:wesley@mystateinsurance.comCounty:Newhanover
Then this is run
<cfset lobType =
ReReplace(noFormat,'[A-Za-z0-9,:@.]+PRODUCTTYPE:(.+)CONTACTCANBEREACHEDAT:Name:(.+),(.+)Home:(.+)Address1:(.+)Work:(.+)Address2:[A-Za-z0-9,:]+ityStZip:(.+),(.+),(.+)Email:(.+)County:(.+)Contact','\1|\2|\3|\4|\5|\6|\7|\8|\9|\10|\11|\12','all')>
and the result is
Homeowners|value|test|5555551212|123TestLn|5555551212|Wilmington|NC|28412|wesley@mystateinsurance.com|Newhanover|...rest
of the string...
This works fine assuming all values are present. But if the
work number, for instance was blank in the initial string then
there is no space in Work:Address2: which ends up not running the
entire conversion correctly.