
April 12th, 2012, 06:07 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 1
Time spent in forums: 8 m 3 sec
Reputation Power: 0
|
|
|
Regex to match multiline but same pattern in python
So python regex allows you to name your auto variables. nice!
But here is the problem
<ProductName>(?P<product_sku1>\w+)</ProductName>
<ProductName>(?P<product_sku2>\w+)</ProductName>
<ProductName>(?P<product_sku3>\w+)</ProductName>
<ProductName>(?P<product_sku4>\w+)</ProductName>
I have an xml file that looks like this. The problem is that ProductName elements can be 0 or more. How do i match all occurrences and push the value into a named variable?
|