Need regex for "plain 1-3 digit number

I am parsing strings for both comma delimited integers, as well as integers. My problem is that with the latter, I am picking up integer strings WITHIN comma delimited numbers.

So, when using: \d{1,3} against "3,000"

I am recognizing "000". However, as it's part of a comma delimited number, I don't want to recognize it, at all.

sperodevAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
(?<![\d,])\d{1,3}(?![\d,])
CEHJCommented:
Sounds like there's something a bit wrong - i.e. you're not matching *all* the comma-delimited ones. Can you post your re?
sperodevAuthor Commented:
I'm sorry if I wasn't clear enough in my post. I want to make 2 totally distinct passes through the string. One pass should only pick up correctly formatted (with commas) numbers, and the other pass should only pick up numbers not associated with commas.

Although I gave the regex for the latter case as: \d{1,3} , this is obviously wrong from another point of view. It would not recognize 34000 from "34000", but instead 340 and then 00.

ozo: I'll try your regex this evening.
ozoCommented:
(\d{1,3}(?:,\d{3})*)
((?<![\d,])\d+(?![\d,]))

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.