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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:59:30+00:00 2026-05-21T20:59:30+00:00

What regular expression should I use to detect is the text I want to

  • 0

What regular expression should I use to detect is the text I want to hyperlink had been already hyperlinked.

Example:

I use

$text = preg_replace('/((http)+(s)?:\/\/[^<>\s]+)/i', '<a href="\\0">\\0</a>', $text);

to link regular URL, and

$text = preg_replace('/[@]+([A-Za-z_0-9]+)/', '@<a href="http://twitter.com/#!/\\1">\\1</a>', $text);

to link Twitter handle.

I want to detect whether or not the text I’m going to hyperlink had been wrapped in <a href=""></a> already.

  • 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-21T20:59:30+00:00Added an answer on May 21, 2026 at 8:59 pm

    Simple, replace the regular URLs first, as it won’t affect anything starting with an @ cause no URL starts with an @. Then replace the twitter handles.

    That way you don’t need to detect if it’s been hyperlinked already.

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

Sidebar

Related Questions

Is there a Regular Expression that can detect SQL in a string? Does anyone
What is a good regular expression that can validate a text string to make
I would like to find a regular expression (regex) that does detect if you
I'm trying to write a regular expression which should be able to identify boolean
My regular expression needs to be able to find the strings: Visual Studio 2008
What follows is a regular expression I have written to match multi-line pre-processor macros
Does anyone have a regular expression handy that will match any legal DNS hostname
Can someone provide a regular expression for parsing name/value pairs from a string? The
I'm running a regular expression against a large scalar. Though this match isn't capturing
I am after a regular expression that validates a percentage from 0 100 and

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.