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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:49:01+00:00 2026-05-23T22:49:01+00:00

I am trying to find some text RegEx /\w*http:[/][/]bit.ly[/]\w*/ig that will find this string

  • 0

I am trying to find some text RegEx /\w*http:[/][/]bit.ly[/]\w*/ig that will find this string and pull it out, moving it to the <span> tag, or at the end of the <p> tag?

<p class="regex">Text before http://bit.ly/wtGAhsu sometext here, doesn't matter how long this is.... <span></span></p>

$("p:regex('(\w*http:[/][/]bit.ly[/]\w*)')").addClass('active');

Above is what I have so far (just selecting the p), I’ve tried .highlight() but Im not sure now to grab the text and move it, any help is much appreciated.

Thanks

  • 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-23T22:49:02+00:00Added an answer on May 23, 2026 at 10:49 pm

    You could use something like this:

    $("p.regex").each ( function () {
        var jThis   = $(this);
        var newSrc  = jThis.text ().replace (/^(.*)(https?\:\/\/bit\.ly\/\w+)(.*)$/i, '$1$3<span>$2</span>');
        jThis.html (newSrc);
    } );
    

    Note that this version assumes one link, max, per paragraph.

    See it in action at jsFiddle.

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

Sidebar

Related Questions

I'm trying to find some text in a long string but my code does
I am trying to find out how many regex matches are in a string.
Am trying to find some text only if it contains english letters and numbers
I'm trying to find URLs in some text, using javascript code. The problem is,
I am trying to find some float number (like -1234.5678) in a huge text
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
I have been trying to find some resource on this topic for a while
I've been trying to find some manual information on this, but my search is
I'm trying to find all labels with an id and text, but my regex
I'm trying to find some text in an XML file and delete only a

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.