I am parsing email raw text bodies, and they have no HTML, so it's a multi line string essentially.
I thought I created a regex to catch: Quote: #403
I need that back as [Quote, 403] from the entirety of this large string.
So heres an example:
$body = "
Test Person
Tester
(123) 123-1234
<mailto:[email protected]> [email protected]
[email protected]
Your Information:
Name: Last, First
Email: [email protected] <mailto:[email protected]>
Phone: (123) 123-1234
Quote: #403";
preg_match('/^[a-zA-Z] : #[0-9] $/i', $body,$matches);
var_dump($matches); // => array(0) {}
Matches is empty. Based on my understanding this should have worked.
Thoughts?
CodePudding user response:
Try removing the "start" and "end" characters and make it multi-line:
preg_match('/[a-zA-Z] : #[0-9] /m', $body,$matches);