Regex pattern problem in python?

Import re def extract_current(s): s = ss. Rfind(' ')+1:-1 s = re. Sub('\d{6}-\d{6}', '', s) s = re.

Sub('A-Z+', '', s) return s print extract_current('24.02 24.02VALINTATALO MEGAHERTSI4,76-') print extract_current('24.02 24.02DOE MRIDANG 157235-1234582,00-') Output: 4,76 2,00.

This seems to work: . *?(\d\d\. \d\d)(.*?)(?:\d{6}-\d{6})?(\d*,\d\d) Explanation: (?:\d{6}-\d{6}) sees the account number but doesn't remember it.

The question mark after it allows the account number to be absent. The reason we don't want to remember the account number is that it throws off the index that we access with match. Group(3).

I.e. , it could be at index 4 if the account number were present.

1. Also, I know the OP used the initial . *?

, but I'm sure it can be dropped if one uses the . Search method instead of the . Match one.

– tzot Apr 13 '10 at 22:24.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions