'How to select each number in a list with RegEx, but only after a specific set of characters?

I have the following RegEx:
/((?<=RGB:\s)\d*){1}[^,\s]+/gm
And the following text to use it on:

RGB: 123, 12, 5
HSV: 23, 119, 223
7

I am trying to have it select all 3 numbers that come after "RGB:", but without including "RGB:" or the spaces and commas in the match. I'm fairly new to RegEx and my expression seems to nearly work but I'm stuck on one issue. It only matches the very first number and stops at the comma. I don't understand the cause of this, and I can't get it to work after altering my RegEx many times. My reasoning for doing this is so I can easily replace many of these numbers in a file with new ones with ease. The language I am using is C#.

What I'm trying to do:

RGB: 123, 12, 5
HSV: 23, 119, 223
7
(Match the 3 numbers after "RGB:")

What it is actually doing:

RGB: 123, 12, 5
HSV: 23, 119, 223
7
(It's matching only the first number after "RGB:")



Solution 1:[1]

In .NET Regex you can use a variable length lookbehind (demo).

(?<=RGB:[\s\d,]*)\d+

Or an idea to use \G to continue where the previous match ended (demo).

(?:RGB:|\G(?!^))[,\s]*(\d+)

This one needs a capturing group but is more efficient, than the first pattern.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1