Regex – selecting only whole numbers with currency – what is wrong with my code?
Referring to these posts as reference:
Regular expression to match numbers with or without commas and decimals in text
Regex – to find whole numbers only – problem
Could any of you enlighten me as to what’s wrong with this code below and how do I make it select WHOLE numbers under varying conditions? I added a comma to the negative lookahead to fulfil additional conditions but it is causing some problems for me where I can’t get certain numbers selected?
My question – How do I get the whole numbers circled in red to be selected as well? I apologise if the solution may seem obvious but I’m pretty new to this and can’t seem to figure the problem with the code below, thanks for your help!
5x Item C $2.5x5, $2.50x1 1 Book $2.55,1x Table $2.59,2x Item A $2000.5x2, 10x Item B $0.5x10 1x Test $2.513, 5x Pear $100x5, $1.430, $1.50, $1.55 10x Tee $0.5x10,2x HKD4,015x2 1x Kettle $50test, 2x Kettle $3.0x, 100x Dogs $5,666,111, 1x Tents $110x1, 5x Pets $500, 10x Shirt $15,000,000x2 15x Pants $3,000x15 100x Paints $1,000,000,000,000x100 $2,000,000,000,000,000 SGD2,000x3 USD2,00 USD2,0 SGD2ttt CNY5,000, HKD10,000, GBP1,500, EUR1,000x1, GBP1,500 $150,000.0 $1,000,000.55 $1,00.00, $1,0.00
Read more here: Source link