A
A
Andrey Samoylenko2016-03-09 23:03:28
PHP
Andrey Samoylenko, 2016-03-09 23:03:28

Why is my regular expression not working?

preg_match_all("/[-0-9_a-z]{3,}[email protected][0-9a-z]{2,}\.[0-9a-z]{2,}/i", $text, $matches);

The problem is with the "." character, I escape it with a slash so that it looks for the dot character, but it does not work. if the slash is removed it works, but then it looks not for a dot, but for any character. Please do not give me a ready-made expression / solution, I want to understand what exactly is my mistake.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-03-09
@Nc_Soft

hocus pocus, fixed

preg_match_all('/[-0-9_a-z]{3,}[email protected][0-9a-z]{2,}\.[0-9a-z]{2,}/i', $text, $matches);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question