greetings of all I have text that can contain emails and I want to detect any occurrence of email and surround it with a tag < a > for example:
< a >
my.email@mycompany.com <a href="mailto:my.email@mycompany.com"> my.email@mycompany.com </a>
Using the regular expression from regular-expression.info , you can do:
text = text.replaceAll("(?i)\\b([A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4})\\b", "<a href=\"mailto:$1\"> $1 </a>");
Perfect link
Source: https://habr.com/ru/post/1782743/More articles:Java interface type as constructor parameters - javaОшибка открытия URL-адреса в Safari - iphoneCan we change the event routing strategy in Windows? - .netcontrol css via php - cssпреобразовывать данные изображения в байтовый код с помощью base64 encodein android - androidEMF generates non-Java code - eclipseProblem installing Windows service using AssemblyInstaller - c #Oracle stored procedure and function converter in SQL Server - oracleFree online version of Pascal - pascalC # Problem with Oauth - c #All Articles