Hi, I have one newsletter script which is having following line preg_match_all('/(\w+@\w+(?:\.\w+)+)/', $data, $array); if data is like Its taking only I think its removing dots also from data which is not desirable. Can you please change the regular expression so that dots are allowed. I am newbie to regular expression .
The \w matches all alphanumeric characters and under scores, so no need to replace it. You can just add the \.\- to it.
preg_match_all('/(\w+(?:\.\w+)+@\w+(?:\.\w+)+)/', $data, $array); Something like that oughta do it, right? Just adding the optional dot and optional second string after the dot like after the @ sign.