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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:29:53+00:00 2026-05-13T05:29:53+00:00

Thanks to Chetan Sastry I have this Regex code to parse my page for

  • 0

Thanks to Chetan Sastry I have this Regex code to parse my page for a list of words and add the TM to them.

var wordList = ["jQuery UI", "jQuery", "is"];
var regExp = new RegExp("\\b" + wordList.join("\\b|\\b") + "\\b", "g");
var $elem = $("#divWithText");
$elem.html($elem.html().replace(regExp, "$&™"));

This Regex is almost what I need.
However, with a link that looks like:

<a href="/0/products/jQuery">jQuery</a>

It ends up appending the TM to the jQuery inside of the href and NOT the one between the tags.

Can anyone help out with this?

The list of words that I’ll be looking for is very specific product names, and the only place they might appear inside of a tag is inside of a link like this.

  • 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-13T05:29:54+00:00Added an answer on May 13, 2026 at 5:29 am

    The only reliable way to accomplish this is to step through each child descendant and, if it’s a text node, then run the replacement.

    Implementations:

    • http://benalman.com/projects/jquery-replacetext-plugin/
    • http://james.padolsey.com/javascript/find-and-replace-text-with-javascript/

    Doing it your way, not only do you run the risk of inadvertently replacing actual HTML, but you also wipe any DOM elements within the targeted element, and any corresponding event handlers.

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

Sidebar

Related Questions

Thanks for reading this. I have markup similar to what is below. Using the
thanks to the help of some of you i have this: Ext.define('PersistantSelectionGridPanel', { extend:
Thanks for checking. All helpful answers/comments are up voted. I have the following code,
Thanks in advance. Getting this warning when using below code: Warning: file_get_contents(test.php) [function.file-get-contents]: failed
Thanks for reading this. I would have thought it would be as simple as
Thanks for reading. I've noticed that if I have a page that has one
Thanks to this board I have managed to retrieve the name and the price
thanks allready for helping me out with this. The following problem occurs: I have
Thanks for reading this. I am dynamically generating some data which includes a select
Thanks for a solution in C , now I would like to achieve this

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.