preg_split

Well, you are more familiar with the code than I am so you would know better than I.
eg. I don’t know why there are matches being captured that apparently aren’t being used.

But one thing I might try is consolidating the eight regex ifs into one something like

"/^(-|On|>)*(.*)(Original Message|wrote:|$fromName|$toName|$toEmail|$fromEmail|On)?(.*)(-|wrote:)*/i"

More difficult to read in some ways, but much less lines to read and have processed.

1 Like