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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:32:00+00:00 2026-06-14T05:32:00+00:00

var text1 = this is %60.94 correct? var text2 = is this %45? var

  • 0
var text1 = "this is %60.94 correct?"
var text2 = "is this %45?"
var text3 = "looks like %45.5/%54.5."
var text4 = "what about 5 or 10 = %22.5.2."

right now I’m using this, text.match(/%[^\s\/\,]+/g), but it doesn’t handle the more edge cases cases.

I need the be able to stop at any non-numeric character except for the first ..

Any pointers on how to modify the regex to do this would be great. Here is the output I would want from each.

text1.match(regex) -> [60.94]
text2.match(regex) -> [45]
text3.match(regex) -> [45.5, 54.5]
text4.match(regex) -> [22.5]

Thanks for any help.

sorry, rules: after any % sign to any non-numeric character except the first instance of a .

also: finding all instances is important

  • 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-06-14T05:32:01+00:00Added an answer on June 14, 2026 at 5:32 am

    The regex can be simply this:

    /%(\d+(\.\d+)?)/
    

    Updated DEMO

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

Sidebar

Related Questions

I am using replace method of string, var text = this ex is not
I'm using the following code.. $(document).ready(function(){ $(#test a).click(function(){ var labelTo = $(this).text(); window.location =
I have something like this : code.js var params = { option1 : encodeURIComponent(text\n
I have some javascript that looks like this: var sel = '<option value={value} {selected}>{name}</option>';
My jquery looks like this var formContent =action=view&msgid=+id; $.getJSON(myserv.php,formContent, function(json){ $.each( json, function(k, v){`
This is my code: var text1 = ↵,<strong>bla bla</strong>;//here text1 has value text1 =
var func = function() { $(this).hide(); $parent = $(this).parent(); $parent.removeClass('my_signature_mouseover'); var text = $(this).val();
I have this piece of code: function func1(text) { var pattern = /([\s\S]*?)(\<\?(?:attrib |if
I have the following function: if ($(this).find('#sel').length == 0) { var before = $(this).text();
I am using Andy Langton's show/hide jQuery code but looks like the code has

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.