P
P
prrrrrrr2020-07-29 11:57:13
PHP
prrrrrrr, 2020-07-29 11:57:13

How to find everything after @ with regular expression?

Can you tell me how to find everything after @ with a regular expression?
For example:

До: [email protected]
После: mail.com

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wisgest, 2020-07-29
@prrrrrrr

preg_replace('/.*@/', '', $email)
But it is considered that it is more correct to use the functions intended for this:
substr(strrchr($email, '@'), 1)

F
FanatPHP, 2020-07-29
@FanatPHP

How to find everything after @

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question