Python regex for dollar amounts including commas and decimals
I'm new to python and I'm writing a bit of code that needs to take a block
of text and remove anything that's not a dollar amount. For example, the
number two thousand may be represented as 2000 2000.00 2,000 and 2k. I'm
trying to accomplish this with a single regex replacement.
Right now I have:
f=re.sub([0-9]+?(,[0-9])*?[0-9]+?(.[0-9])*?[TtBbMmKk],"",f)
While I understand that this is completely incorrect and does not compile,
I'm not proficient enough to know what to do about it. Can anyone give me
some guidance? Thanks!
No comments:
Post a Comment