need to have an optional match however the information I want is a submatch inside of the optional match. However in the cases where it should match it doesn't because it's optional, so the last submatch is empty
This is the full pattern:
Code: Select all
/<div style=\'font-size: 18px;.*\'>(.*)<\/div>.*Product Code: <b>(.*)<\/b>.*\\$(.*)<\/font>.*<img.*>.*<img.*>.*<img src=\'(.*)\'.*>.*(?:<div.*><b>Product Description<\/b><\/div>.*<div.*>(.*)<\/div>)?/isU
The part that I'm having difficulty with is the part on the end
Code: Select all
(?:<div.*><b>Product Description<\/b><\/div>.*<div.*>(.*)<\/div>)?
Some page have the "Product Description" html code but some don't. However because I have made it optional it doesn't match on the pages it should, if I take out the optional (?...)? part it matches fine the problem is trying to match pages that dont' have the Product Description section