Take the 2-minute tour ×  Recently I have sent a newsletter to
an old email database I own. After a couple of years it was
created, it appears that approximately 30% of those emails are
inactive - I've received thousands of Mail Delivery Failure
messages.  All these failure notifications are stored on my
server as text-files and they are replies containing the text I
have sent to my subscribers. Each email has in its text the
user's id. This id is preceded by a bit of common text,
something like  <a href="abc.com?id=123321"></a>  and it's
'123321' I want to extract from each failure report I have
received.  First I started to do that manually and collect
everything one by one. After 500 emails my eyes felt on the
floor and I'm sure there's a solution with php and some
functions. I was thinking of putting all of them into one big
file and to find a preg_match way to do it or to try something
with regex expressions.  How would you deal with such a problem
and where should I look for a solution?  share|improve t