title: How to use re() to extract data from javascript variable using scrapy?
body: <p>My items.py file goes like this:</p>
  
  <pre><code>from scrapy.item import Item, Field
  
  class SpiItem(Item):
      title = Field()
      lat = Field()
      lng = Field()
      add = Field()
  </code></pre>
  
  <p>and the spider is:</p>
  
  <pre><code>import scrapy
  import re
  
  from spi.items import SpiItem
  
  class HdfcSpider(scrapy.Spider):
      name = "hdfc"
      allowed_domains = ["hdfc.com"]
      start_urls = ["http://hdfc.com/branch-locator"]
  
      def parse(self,response):
          addresses = response.xpath('//script')
          for sel in addresses:
              item = SpiItem()
              item['title'] = sel.xpath('//script[@type="text/javascript"][1]').re('(?&lt;="title":).+(?=")')
              item['lat'] = sel.xpath('//script[@type="text/javascript"][1]').re('(?&lt;="latitude":).+(?=")')
              item['lng'] = sel.xpath('//script[@type="text/javascript"][1]').re('(?&lt;="longitude":).+(?=")')
              item['add'] = sel.xpath('//script[@type="text/javascript"][1]').re('(?&lt;="html":).+(?=")')
              yield item
  </code></pre>
  
  <p>The whole javascript code, on viewing page source, is written inside: <code>//html/body/table/tbody/tr[348]/td[2]</code>.</p>
  
  <p>Why is my code not working?
  I want to extract just the four fields mentioned in the items file.</p>