L
L
lexstile2018-05-10 17:56:05
Regular Expressions
lexstile, 2018-05-10 17:56:05

How to modify a regular expression?

The expression itself:
([^@]{1}|^)(@[a-zA-z\.\d]+)
Example: https://regex101.com/r/9hfuzi/2/
From the question: How to correctly compose a regular expression in php?
1. It is necessary to exclude the dot (".") after @ - @.test (exclude)
2. It is necessary to exclude the repetition in the middle of the dot (".") more than 1 time (> 1) - @test..test (exclude)
3. You need to exclude the dot at the end of the @test expression you are looking for. (delete)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-05-20
@lexstile

/([^@]|^)(@(?!\.|[a-z\d.]+?\.(?![a-z\d]))[a-z\d.]+)/i

https://regex101.com/r/9hfuzi/5

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question