-2

I'm scraping this from some site and from this text " See all {a number will be there} employees".

Now this number is separated by "," as in 1,200. So what will be the regex to generalize as it could be 200 or 1,200 or 12,345,098.

Attempt

[0-9]+\.[0-9]+
Community
  • 1
  • 1

1 Answers1

2

This expression would simply output our desired number:

([0-9,]+)

or

(\d+,?)

which is a capturing group, including any digit and any optional comma. If necessary, we could bound it more if we wish to.

DEMO 1

DEMO 2

Advice:

The fourth bird:

I think repeating the comma and the digit would be more precise like for example \d+(?:\,\d+)* or else in a text first pattern can also match a separate comma and only match separate groups with the second.

RegEx Circuit

jex.im visualizes regular expressions:

enter image description here

Emma
  • 27,428
  • 11
  • 44
  • 69