Regular Expressions in a comma delimited .txt file
Posted: Wed Oct 31, 2001 4:20 am
Hi all,
I have a comma delimited text file with rows like:
"txtLastName","txtFirstName","chrSSN","txtPhoneNumber","vchrAddress1","vchrtxtAddress2","chrCity","chrState","vchrHomeAddressZipCode"
"Allen","Arnold","000-00-0000","555-555-1234","123 Indian Rd.",,"Cityville","CA",12345
--
So far...
the expression i have wrote is: [0-9][0-9][0-9]\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]
it finds phone numbers in a comma delimited .txt file like 123-456-7890
I think I also need to include the quotes on the phone number too, but i don't know how. I have looked for regex resources high and low to find out...
i want to seperate the areacode from the rest of the number and change the text file so if it said:
"Allen","Arnold","000-00-0000","555-555-1234","123 Indian Rd.",,"Cityville","CA",12345
I could use regex to find and replace the phone number so it would become:
"Allen","Arnold","000-00-0000","555", "555-1234","123 Indian Rd.",,"Cityville","CA",12345
--
Please help!! This text file is giving me a sever headache - it is 7000+ records long!!!
Sincerely,
-Josh Tiner
jtiner@tampabay.rr.com
I have a comma delimited text file with rows like:
"txtLastName","txtFirstName","chrSSN","txtPhoneNumber","vchrAddress1","vchrtxtAddress2","chrCity","chrState","vchrHomeAddressZipCode"
"Allen","Arnold","000-00-0000","555-555-1234","123 Indian Rd.",,"Cityville","CA",12345
--
So far...
the expression i have wrote is: [0-9][0-9][0-9]\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]
it finds phone numbers in a comma delimited .txt file like 123-456-7890
I think I also need to include the quotes on the phone number too, but i don't know how. I have looked for regex resources high and low to find out...
i want to seperate the areacode from the rest of the number and change the text file so if it said:
"Allen","Arnold","000-00-0000","555-555-1234","123 Indian Rd.",,"Cityville","CA",12345
I could use regex to find and replace the phone number so it would become:
"Allen","Arnold","000-00-0000","555", "555-1234","123 Indian Rd.",,"Cityville","CA",12345
--
Please help!! This text file is giving me a sever headache - it is 7000+ records long!!!
Sincerely,
-Josh Tiner
jtiner@tampabay.rr.com