Question: I want to fetch the whole and decimal numbers from paragraph. I'm using jQuery and regular expression for this. here is my code:

```
jQuery("#Content_Text p, #Content_Text td").html(function (index, value) {
        value = value.replace(/(\s[1-9]\d*(\.\d+)?(\s,\.,\,,\%)?)/, "<em style=\"color:#FF6600; font-size:12px; font-style: normal;\">$1</em>");
        return value;
    });

```

Matching & not matching examples:

1. has catapulted its position as the top 3 `<3 is matched>` countries
2. India stands 3rd `<3 is matched>` in the global housing index for 2012. `<2012. is not matched>`
3. \*Economy and Realty, October 2012, Knight Frank. `<2012. is matched>`
4. India is in the range of 18.6% - 29% pa `<18.6 is matched> but 29% is not!`

Please help me, I want to match all these cases!.

Thanks in advance

Answer: 
I think you should use a class character instead of `(\s,\.,\,,\%)`

```
[\s.,%]

```
Use the /g flag on your regex to match more than just the first occurence. Also, this part of your regex is a bit odd:

```
(\s,\.,\,,\%)?

```

I suspect you don't actually need any of that. You made it optional anyway, so it won't matter. Also, there's a redundant digit matching in the beginning. Try this:

```
value.replace(/\s(\d+(\.\d+)?)/g, "<em style=\"color:#FF6600; font-size:12px; font-style: normal;\">$1</em>")

```

Note that you're requiring an empty space, \s, in front of the number. That won't match in the beginning of sentences. Try replacing it with a word boundary, \b, if that's what you want.