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
The regex can be simply this:
Updated DEMO