I have a list (string) of data that I would like to split into variables using regular expression:
Company Name: Some Company Telephone: (123) 456-7890 Email: name@domain.com
I would like to get it to:
$company = ‘Some Company’, $phone = ‘(123) 456-7890′, $email =’name@domain.com’
Where I am running into problems is the only delimiter is ‘:’ and spaces. I have not started formulating a regex pattern yet. I tried using explode but that was adding the next item onto the last. ie;
$pieces = explode(":", $list);
$pieces[0] // Company Name
$pieces[1] // Some Company Telephone
...
You can try to split the line with regular expression: