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 7850797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:58:23+00:00 2026-06-02T18:58:23+00:00

I know that this can be done using settings in Outlook, but that only

  • 0

I know that this can be done using settings in Outlook, but that only sorts the issue for myself.

What I would like to do is use PHP to prevent text from being hyperlinked just because there is an @ sign etc…

As far as I can see, the only option for me is to encode all @ signs to their HTML numeric entity like so:

Something like this:

$message = str_replace('@','@',$message);

However, if possible, I do not want this to happen if the @ sign is part of an email address.

Therefore I need something like this:

// SOME_REGEX will match any @ sign that is NOT part of an email address
$message = preg_replace('SOME_REGEX','@',$message);

Can anybody think of any other better methods? Are there any flaws in this plan? Can anyone suggest a good regular expression for this? I am struggling to write a regex that matches an @ sign if it is not part of an email address

Thanks in advance

  • 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-06-02T18:58:24+00:00Added an answer on June 2, 2026 at 6:58 pm

    This will not work if the email address is wrapped in anything not defined in the trim list.

    $chunked_message = explode(" ", $message);
    
    foreach($chunked_message as $chunk) {
        $clean_chunked_message[] = 
                   (!filter_var(trim($chunk, " -().?!\t\r\n", FILTER_VALIDATE_EMAIL)) 
                   ? str_replace('@', '@' $chunk) : $chunk;
    }
    
    $clean_message = implode(" ", $clean_chunked_message);
    

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this can be easily done by using if(i%5 == 0 OR
I know that this is possible to be done with application settings, but I
I know that I can iterate over an object's properties like this: for (property
Heyy can somebody help me ? i have this issue that still do know
Sorry that I can't find the answer through google - But I know this
I know there is a method like this : setTimeout(functionA();,1250); That can delay my
I know that this has already been asked here but the answer (using a
I know that eclipse can do this, can Intellij via the new Android support
I know that horizontal partitioning...you can create many tables. How can you do this
I want to know that How can I walk through this loop ? this

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.