I have a text document with a slew of email addresses which I converted from a pdf.
here is an example of of what it looks like:
name1;someone@awebite1.com;;;
name2;someone@awebite2.com;;;
name3;someone@awebite3.com;;;
name4;someone@awebite4.com;;;
name5;someone@awebite5.com;;;
etc… 600+ contacts
anyone know to to write a simple php pattern/expression/regex I can use to separate the name and email one by one so I can put in database?
the database of course would be a simple: id | contact | email
any help would be gladly appreciated!
I forgot to mention, I would like to do it in php. I will incorporate the code into a form for future usage.
In PHP, you can split a string using the explode function..
The returned array contains each part separated by
;.For this, each line in your text document has to be given as
inputString. So loop through the array returned byand call
explodewith each element. The abovepreg_splitreturns an array with each line of the input as an element.Combining both,
Note : I have only a little knowledge in php. There may be better code.