I\'m trying to extract data from this script tag using Scrapy:
Following regex seems to be correct:
r"data\.bundles\[[^\]]*\] = {([^}]*)}"
*
in regexes is greedy - it will always try to match as much as possible, so i use [^\]]
to make sure that I will match the closest ]
. I do the same with {}
brackets. Additionally, I don't have to worry about .
not matching newline.