Python regex to match million or billion quantities but not dollar amounts -


I am using Python 2.6.9 for some regex, and I have the following string, where I will match Want 111,111,111 and 222,222, but not the amount of dollars

This is my current best effort:.?!

  regexObj = re.compile (r '(& lt; \ $) \ d {3} (:, \ d {3}) *') testStr1 = '111,111,111 and 222, 222 but not $ 333,333,333 or $ 444,444 'regexObj.findall (testStr1) [' 111,111,111 ',' 222,222 ',' 333,333 ','  

"lesson">

Btam, please note that if you want to meet only millions and billions, then there is a problem in your * quandafaire. This is what you want, if you can specify something under tuning for borders,

  \ b (  

Note that the last quantifier is {1,2} is * because you said that you want to match millions and billions. With a * , you can match thousands, billions and zillions.

If you have more information about the borders, (for example, you are matching an entire string, or you always have a place after the expected number), we can make mailing more accurate, Neither by anchoring or by adding borders.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -