Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7415195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:15:11+00:00 2026-05-29T07:15:11+00:00

I am trying to implement similar feature in my website and wanted to display

  • 0

I am trying to implement similar feature in my website and wanted to display email like below .

enter image description here

Below is the MYSQL code I have written and it is working OK for the scenarios I tested . But wanted to check with you guys if we have any better solution for this .

SELECT CONCAT(RPAD(CONCAT(RPAD(firstletter, firstpartlength - 2, '*'),
                   beforedomain), (
                            secondpartlength - Length(afterdot) +
                            firstpartlength ),
                     '*'), afterdot) hiddenemail
FROM   (SELECT SUBSTRING(email, 1, 1)                             firstletter,
               SUBSTRING(email, INSTR(email, '@') - 1, 3)         beforedomain,
               SUBSTR(SUBSTRING(email, INSTR(email, '@')),
               INSTR(SUBSTRING(email,
                     INSTR(email, '@')), '.'))
                      afterdot,
               LENGTH(SUBSTRING(email, 1, INSTR(email, '@') - 1))
               firstpartlength,
               LENGTH(SUBSTRING(email, INSTR(email, '@') + 1))
               secondpartlength
        FROM   test_table) a 

Thanks for your help

Regards
Kiran

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:15:12+00:00Added an answer on May 29, 2026 at 7:15 am

    As stated in my comment, I would recommend a PHP-based solution like this:

    <?php
    $email = 'youremail@ddre.ss';
    
    $beforeAt=explode("@",$email);
    $beforeAt=$beforeAt[0];
    $asterisks=str_repeat("*",strlen($beforeAt)-2);
    $beforeAt=$beforeAt{0}.$asterisks.substr($beforeAt,-1);
    $domain=explode("@",$email);
    $domain=explode(".",$domain[1]);
    $extension=$domain[count($domain)-1];
    $domain=implode(".",$domain);
    $domain=substr($domain,0,-1*strlen($extension)-1);
    $asterisks=str_repeat("*",strlen($domain)-1);
    $email=$beforeAt."@".substr($domain,0,1).$asterisks.".".$extension;
    
    echo $email;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a similar feature like the autosuggest feature for tags
I am trying to implement a feature similar to the Related Questions on StackOverflow,
I am trying to implement a feature similar to the "Related Questions" on Stackoverflow.
I'm trying to implement an autosuggest similar to the below image in that it
I am trying to implement a groups feature similar to that of Facebook in
I'm trying to implement a feature similar to StackOverflow's tag feature. That a user
I'm trying to implement JavaScript based image zoom feature similar to the ones mentioned
I'm trying to implement something similar to Ruby on Rails' polymorphic relationships. I have
I am trying to implement a system on my website similar to that of
I am trying to implement something similar to the share feature on Dropbox that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.