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 o
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
}
)