rearden
rearden

Reputation: 135

How to exclude commas from word boundaries

I'm attempting to parse thousand/million/hundred million values out of plaintext. I need to exclude commas and decimals from the typical word boundaries so 1,000,000 doesn't return multiple hits. I need my values to be exclusive and only match at the highest number. How do I recreate word boundary functionality that ignores commas and decimals?

Upvotes: 0

Views: 255

Answers (1)

YOGO
YOGO

Reputation: 551

Word boudary \b does not include commas, it includes: (^\w|\w$|\W\w|\w\W) , \w represents: [a-zA-Z0-9_] and \W is like NOT \w in this way: [^a-zA-Z0-9_]

Maybe you need this : [\d,.]+

It will match 1,000,000 or 1,000.000 ...

Upvotes: 3

Related Questions