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

  • Home
  • SEARCH
  • 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 5960915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:53:32+00:00 2026-05-22T18:53:32+00:00

I have this code htmlString= htmlString.replace( new RegExp( WW(.+?)WW, gim ), <span style=’color:red;border-bottom:1px dashed

  • 0

I have this code

htmlString= htmlString.replace( new RegExp( "WW(.+?)WW", "gim" ),
    "<span style='color:red;border-bottom:1px dashed red;'>$1</span>" );

This seems to work however it is replacing the www’s in url’s. What I have is WW somestring WW I clip out the text between WW and replace it. However, I can’t seem to only get the exact char sequence. I tried {WW} ^WW [^WW] with the end [$WW] and variations. Also tried \bWW string \bWW and no match.

Any help would be great, 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-22T18:53:32+00:00Added an answer on May 22, 2026 at 6:53 pm

    Assuming that there is something else than alphanumeric characters after the starting WW and before the ending WW (whitespace, for example), then you could do this:

    htmlString = htmlString.replace(/\bWW\b\s*(.+?)\s*\bWW\b/g, 
        "<span style='color:red;border-bottom:1px dashed red;'>$1</span>" );
    

    Using a regex object instead of a string literal makes it easier to read. If you had used \b in a string literal it would have meant “backspace” – you need to escape backslashes in a string literal, so the above regex would become "\\bWW\\b\\s*(.+?)\\s*\\bWW\\b".

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

Sidebar

Related Questions

I have this line of code that forms an html string: StringBuilder builder =
I have a variable containing html string. This string has this particular code <a
i am not sure if this is a good route to go,...i have some
I have this string containing a large chunk of html and am trying to
I am working on a Web Forms application and I have some HTML code
Let's say we have the following JavaScript/jQuery code below function createElement(i, value) { return
<? $string = ' Some photos<br> <span class=naslov_slike>photo_by_ile_IMG_1676-01</span><br /> <span class=naslov_slike>photo_by_ile_IMG_1699-01</span><br /> <span class=naslov_slike>photo_by_ile_IMG_1697-01</span><br
I have a simple list of items that needs to be printed using Cocoa.
I have no previous experience with FubuMVC HtmlTags library, and I simply got stuck
I have a website that allows to enter HTML through a TinyMCE rich editor

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.