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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:03:46+00:00 2026-05-25T15:03:46+00:00

<font color=green>+4,13</font>% I know that I shouldn’t use regular expressions for that, but that’s

  • 0
<font color="green">+4,13</font>% 

I know that I shouldn’t use regular expressions for that, but that’s a single case where my only html is that so…

how can I get “4,13” from the string above?

EDIT

Context:

I am sorting a table via jQuery TableSorter. A column contains that html-formatted data and I can’t change it. The custom parser I’m writing has a format function, which I currently use for managing currency, percentages and so on…

Now, I want to check, with a regex, if the string that comes to me is a string.

format: function(s) {
    console.log(s);
    var stripped = s.replace("<font>","")
                     .replace("</font>", "");
    return jQuery.tablesorter.formatFloat(stripped);
}
  • 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-25T15:03:46+00:00Added an answer on May 25, 2026 at 3:03 pm

    This should work for your specific example –

    var tagtext = '<font color="green">+0.00</font>%';
    var keepplusorminus = false;
    var myregexp = keepplusorminus ? /[-\+,\.0-9]+/ : /[,\.0-9]+/;
    var match = myregexp.exec(tagtext);
    if (match != null) {
        result = match[0];
    } else {
        result = "";
    }
    alert(result);
    

    Working demo – http://jsfiddle.net/ipr101/LHBp7/

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

Sidebar

Related Questions

Anyone know why CSS provides color for text, but does not have font-color or
When I receive html text by ajax in asp.net application it looks like: &lt;span%20style='color:green;font-weight:bold'&gt;%20Text%20Msg&lt;/span&gt;
The exact background color is known. Imagine an anti-aliased font on a green background.
Does anyone know the properties that I need to change to decrease the font
I want to set the font color of a cell to a specific RGB
I need to change the font color of a div with the id name
How can I have one UILabel with two different font color/type? I don't think
When I disable input elements the text is taking the font color: #000000 in
ParseError: /Users/JMiller/Projects/multisport-momentum/public/stylesheets/style.styl:15 11| color #031634 12| } 13| a { 14| color font.color >
$(b).bind(contextmenu,function(e){ thiselementselected = e.target $(#add).bind(click,function(e){ thiselementselected.css(font-color, red); return false }); $(#remove).bind(click,function(e){ thiselementselected.css(font-color, ); return

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.