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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:38:24+00:00 2026-05-16T01:38:24+00:00

Once again, I need some help and I appreciate you all for being here

  • 0

Once again, I need some help and I appreciate you all for being here willing to help.
I’m trying to implement a regex for a JavaScript function that will replace a string of text contained in an HTML tag, but ignoring the tag altogether.
For example:
The string I need to find and replace is the dollar sign ($),
and the HTML that I’m working with looks like this:

<div class="myClass">
    <input type="radio" value="$233.93" name="myInput" id="myInputId">
    <label>
        $36.<sup>07</sup>
    </label>
</div>

As you can see, I have a dollar amount in the value attribute of the input tag, and another dollar amount inside the label tag.
All this HTML is contained within a td (table cell), which in turn is part of a table, for which I’m implementing a sorting by column functionality.
My problem is that I have not been able to come up with a regex that would ignore the HTML tags altogether and match only the string inside my label tag ($36.<sup>07</sup>).
I put together this regex: /[$](?=(\d{2,5}[.<]))/
This regex works, but only half way, because it matches the first dollar sign in the value of the value attribute, granted the regex it’s not set to global, because it would replace all dollar sign and I don’t wan’t to do that, and I cannot change the structure of the HTML either.

Any help would be greatly 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-16T01:38:24+00:00Added an answer on May 16, 2026 at 1:38 am

    You can solve this easily with jQuery:

    jQuery.trim( jQuery('label').text() )
    

    That will strip the tags for you, and produce $36.07 which you can then test with a much simpler regex.

    (If you’re not currently using jQuery, and don’t want to use it, you can still take a look at the source code for it and see how they’ve implement the .text() function in order to emulate it.)

    Hmmm, Re-reading your question, you might be asking something else – to retrieve all labels containing $ (and ignore the inputs) you can do:

    jQuery('label:contains($)')
    

    or

    jQuery('label').each( checkForDollars );
    
    function checkForDollars()
    {
        if ( jQuery(this).text().matches(/\$\d{2,5}/) } )
        {
            // do something
        }
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Once again I need some help. I'm creating a multiple file upload function with
I received some great help here the other day and hope once again I
So once again I need some help with this program for class. Maybe its
Once again I need some much appreciated help from the experts :) I am
Once again I need some help. I'm working with a table that contains 3
Once again I need your Help, am thanking you as every time you helped
I am once again looking for some help. I have found this stopwords script
I need some help I am new to jQuery and I am trying to
Hey all, i am new at everything VB.net/ASP.net so i need some help with
I need your expertise once again. I have a java class that searches 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.