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

Please tell me what regular expression should i use to validate cricket overs in
what is the regular expression which i should use to match a string which
I want to convert a link to a definite text by using regular expression.While
If this is my string : blablabla (blablabla). Which regular expression should i use
I use the following regular expression for validating one of my text areas: ^[a-zA-Z0-9][a-zA-Z0-9
I have 20-25 textboxes in the form. should I use regular expression control in
I need a regular expression that should validate decimal point as well as range.
I am trying to write regular expression for this pattern: String word=113(112,9); It should
SOURCE_GROUP(Test FILES ${Test_files}) Checking the documentation, FILES should be a regular expression. But what
What regular expression can I use (if any) to validate that a given string

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.