views:

63

answers:

1

Hi all,

I'm having trouble creating a regex. Here is a sample of the text on which the regex should work:


<b>Additional Equipment Items</b> <br>
40001 <br>
1  Battery Marathon L (8 cells type L6V110) <br>
40002 <br>

What I now want to select is >>1<< and >>Battery Marathon L (8 cells type L6V110)<<.

Therefore I have produced the following Regex:

found = re.findall('<b>.*Items\s*<\/b>\s*<br>(?:\s*[1-4]0[0-9][0-9][0-9] <br>\s*(\d*) (.*) <br>)*', content)

Seems like the outer regex does match, but the inner groups are empty :(

Any suggestions?!

A: 

Okay I sometimes just hate Regex. Some whitespaces owned me...

Here is the solution:

<b>.*Items\s*<\/b>\s*<br>(?:\s*[1-4]0[0-9][0-9][0-9] <br>\s*(\d*)\s*(.*) <br>)
Michael S