Hi
I am trying to learn more about regular expressions I have one below that I believe finds cases where there is a missing close paren on a number up to 999 billion. The one below it I thought should do the same but I do not get similar results
missingParenReg=re.compile(r"^\([$]*[0-9]{1,3}[,]?[0-9]{0,3}[,]?[0-9]{0,3}[,]?[0-9]{0,3}[.]*[0-9]*[^)]$")
missingParenReg2=re.compile(r"^\([$]?([0-9]{1,3}[,]?)+[.]*[0-9]*[^)]$")
I think the second one says:
There must be an open paren to start
There may or may not be as many as one dollar sign
The next group must exist at least once but can exist an unlimited number of times
The group should have at least one digit but may have as many as three
The group may have as few as 0 and as many as 1 commas
Following this group there may or may not be a decimal point
If there is a decimal point it will be followed by as many as 0 but as many as uncounted occurences of digits
At the end there should not be a closing paren.
I am trying to understand this magic stuff so I would appreciate a correction to my regex (if it can be corrected) in addition to a more elegant solution if you have it.