Answer by MarGin for masking of email address in java
Kotlin Extension/** * Format email id in the following format * (m••••••n@gmail.com) * only exception for 2 character username in that case it will be ••@gmail.com * @return formatted email */fun...
View ArticleAnswer by Deep for masking of email address in java
public static string GetMaskedEmail(string emailAddress) { string _emailToMask = emailAddress; try { if (!string.IsNullOrEmpty(emailAddress)) { var _splitEmail = emailAddress.Split(Char.Parse("@"));...
View ArticleAnswer by Ajay Prajapati for masking of email address in java
//In Kotlinval email = "nileshkemse@gmail.com"val maskedEmail = email.replace(Regex("(?<=.{3}).(?=.*@)"), "*")
View ArticleAnswer by user1079877 for masking of email address in java
I like this one because I just want to hide 4 characters, it also dynamically decrease the hidden chars to 2 if the email address is too short:public static String maskEmailAddress(final String email)...
View ArticleAnswer by Wiktor Stribiżew for masking of email address in java
Your look-ahead (?=[^@]*?.@) requires at least 1 character to be there in front of @ (see the dot before @).If you remove it, you will get all the expected symbols replaced:(?<=.{3}).(?=[^@]*?@)Here...
View ArticleAnswer by Andy Turner for masking of email address in java
If you're bad at regular expressions, don't use them :) I don't know if you've ever heard the quote:Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they...
View ArticleAnswer by TheLostMind for masking of email address in java
Your Look-ahead is kind of complicated. Try this code :public static void main(String... args) throws Exception { String s = "nileshkemse@gmail.com"; s= s.replaceAll("(?<=.{3}).(?=.*@)", "*");...
View Articlemasking of email address in java
I am trying to mask email address with "*" but I am bad at regex.input : nileshxyzae@gmail.comoutput : nil********@gmail.comMy code isString maskedEmail = email.replaceAll("(?<=.{3}).(?=[^@]*?.@)",...
View ArticleAnswer by tom for masking of email address in java
This will try to mask even if the character count before the @ is less than or equal to 3. public static String maskEmail(String fieldValue) { if (StringUtils.isBlank(fieldValue)) { return ""; } int...
View Article