B
B
Bogdan2020-02-19 16:04:53
JavaScript
Bogdan, 2020-02-19 16:04:53

How to truncate a point with a regular expression?

How to get an email without a dot at the end using a regular expression? There are typos and therefore it is necessary to remove this point.
For example "[email protected]" the output should be "[email protected]".

console.log(('Адрес: [email protected]'.match(/(?:Адрес: )(.+)(?:\.*?)$/) || [])[1]);
console.log(('Адрес: [email protected]'.match(/(?:Адрес: )(.+)(?:\.*?)$/) || [])[1]);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2020-02-19
@bogdan_uman

str.replace(/\.$/, '')

M
Michael Aniskin, 2020-03-02
@MichaelAniskin

preg_match(/[0-9a-z_\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]*@ [0-9a-z\-]{2,63}.[az]{2,3}/')
It seems that everything was turned on correctly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question