Skip to main content
Participating Frequently
May 1, 2009
Answered

Hide Email Address From View

  • May 1, 2009
  • 1 reply
  • 1295 views

We have clients that we have told not to post their email in a textarea form and they do it anyway.  Is there a way to find the email address in the textarea output (public view page) and then ******* or whatever their entire email address before and after the @17299028  We do not want any of the email showing.  Thanks in advance.

    This topic has been closed for replies.
    Correct answer craigkaminsky

    You could use a regular expression (where appropriate in the flow of your code) to locate an email address and replace it with the desired characters. Here's a sample:

    ReReplaceNoCase( originalString, "^[a-zA-Z_0-9-'\+~]+(\.[a-zA-Z_0-9-'\+~]+)*@([a-zA-Z_0-9-]+\.)+[a-zA-Z]{2,7}$", "*********@******", "ALL" )

    This snippet should find any email addresses in the variable originalString and replace it with *********@******.

    Hope that helps!

    1 reply

    craigkaminskyCorrect answer
    Inspiring
    May 1, 2009

    You could use a regular expression (where appropriate in the flow of your code) to locate an email address and replace it with the desired characters. Here's a sample:

    ReReplaceNoCase( originalString, "^[a-zA-Z_0-9-'\+~]+(\.[a-zA-Z_0-9-'\+~]+)*@([a-zA-Z_0-9-]+\.)+[a-zA-Z]{2,7}$", "*********@******", "ALL" )

    This snippet should find any email addresses in the variable originalString and replace it with *********@******.

    Hope that helps!

    coverAuthor
    Participating Frequently
    May 1, 2009

    Thanks!  You rock!

    coverAuthor
    Participating Frequently
    May 1, 2009

    Hmmm....the code is still not finding the emails in the output.  Any ideas on why this would not work?  The output is just a paragraph of data submitted through a textarea form.

    #ReReplaceNoCase(data.comments,"^[a-zA-Z_0-9-'\+~]+(\.[a-zA-Z_0-9-'\+~]+)*@([a-zA-Z_0-9-]+\.)+[a-zA-Z]{2,7}$", "*********@******", "ALL")#