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

The Archive Base Latest Questions

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

I am trying to find similar strings in feedback option texts using regex to

  • 0

I am trying to find similar strings in feedback option texts using regex to make them bold. Example feedback option list.

  • Your risk is low.
  • Your risk is low to moderate.
  • Your risk is moderate.
  • Your risk is moderate to high.
  • Your risk is high.

The following code works in Jquery but it only finds the first matched word so “low”, “moderate” and “high” are found but then it doesn’t match the word groups “low to moderate” or “moderate to high”. How can I make sure it would look for each option without exiting the regex on the first found single word?

var feedBackRiskTxt = currentFeedbackNode.find('Risk[result='+choice+']').text().replace(/(\blow|low to moderate|moderate|moderate to high|high\b.)/, "<span>$1</span>");

Thank you in advance, Attila

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

    It looks to me like you need the “g” option on your regex so it will replace all matches it finds.

    Also, you aren’t using the \b characters correctly if you want a word boundary on both ends of every match and the match of a trailing period wasn’t working properly either. You can use this to fix those issues:

    var feedBackRiskTxt = currentFeedbackNode.find('Risk[result='+choice+']').text().replace(/\b(low|low to moderate|moderate|moderate to high|high)\./g, "<span class='bold'>$1.</span>");
    

    You can see it work here: http://jsfiddle.net/jfriend00/Y8Csf/.

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

Sidebar

Related Questions

Trying to find an example that has css rollover using sprites & sliding door
I'm trying to find similar or equivalent function of Matlabs Bwareaopen function in OpenCV?
I'm trying to find out how similar these two loops are when compiled: for
I´m trying to find similar rows in multiple two-dimensional arrays as it was described
I am trying to capture sub-strings from a string that looks similar to 'some
I'm trying to find the best approach to filtering a list with C# (3.5)
I've been trying to make my app implement the built in quick search, similar
I have a list of strings.. each one looks similar to this: \n\t\BLOCK\,\HEADER-\\r\n\t\t\NAME\,\147430\\r\n\t\t\REVISION\,\0000\\r\n\t\t\DATE\,\11/11/10\\r\n\t\t\TIME\,\10:03:47\\r\n\t\t\PMABAR\,\\\r\n\t\t\COMMENT\,\\\r\n\t\t\PTPNAME\,\0805C\\r\n\t\t\CMPNAME\,\0805C\\r\n\t\BLOCK\,\PRTIDDT-\\r\n\t\t\PMAPP\,1\r\n\t\t\PMADC\,0\r\n\t\t\ComponentQty\,4\r\n\t\BLOCK\,\PRTFORM-\\r\n\t\t\....(more).... What
I'm trying to find a way to iterate through an enum's values while using
I am trying to find functionality in python similar to the Ruby function scan.

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.