title: Find a list inside of json data with regular expressions
body: <p>I am trying to find a list inside of JSON data with RegEx. Here is my code:</p>
  
  <pre><code>import requests
  from bs4 import BeautifulSoup
  import re
  import json
  
  source = requests.get('https://www.tripadvisor.ch/Hotel_Review-g188113-d228146-Reviews-Coronado_Hotel-Zurich.html#REVIEWS').text
  
  soup = BeautifulSoup(source, 'lxml')
  
  pattern = re.compile(r'window.__WEB_CONTEXT__={pageManifest:(\{.*\})};')
  script = soup.find("script", text=pattern)
  dictData = pattern.search(script.text).group(1)
  jsonData = json.loads(dictData)
  
  
  pattern2 = re.compile(r'^\"[0-9]*\":{\"data\":{\"locations\":(.*)},')    
  data_list = pattern2.search(str(jsonData)).group(1)
  print(data_list)
  </code></pre>
  
  <p>With this regular expression <code>pattern2 = re.compile(r'^\"[0-9]*\":{\"data\":{\"locations\":(.*)},')</code> I want to find the value (list) of <code>locations</code>, but I get an error AttributeError: 'NoneType' object has no attribute 'group'.</p>
  
  <p>The part of JSON data that I want to find looks like this:</p>
  
  <pre><code>"3960485871": {
              "data": {
                  "locations": [
                      {
                          "detail": {
                              "hotel": {
                                  "aliases": [
                                      {
                                          "id": 1099146,
                                          "locale": "de",
                                          "score": 390000,
                                          "text": "hotel coronado"
                                      },
                                      {
                                          "id": 1261196,
                                          "locale": "es",
                                          "score": 260000,
                                          "text": "hotel coronado"
                                      },
                                      {
                                          "id": 261321,
                                          "locale": null,
                                          "score": 112500,
                                          "text": "coronado hotel z\u00fcrich"
                                      }
                                  ],
                                  "details": {
                                      "numRooms": 40
                                  }
                              },
                              "priceRange": {
                                  "maximum": 212,
                                  "minimum": 133
                              }
                          },
                          "formerName": null,
                          "locationId": 228146,
                          "neighborhoods": [],
                          "parents": [
                              {
                                  "locationId": 188113,
                                  "name": "Z\u00fcrich",
                                  "placeType": "MUNICIPALITY"
                              },
                              {
                                  "locationId": 188111,
                                  "name": "Kanton Z\u00fcrich",
                                  "placeType": "CANTON"
                              },
                              {
                                  "locationId": 188045,
                                  "name": "Schweiz",
                                  "placeType": "COUNTRY"
                              },
                              {
                                  "locationId": 4,
                                  "name": "Europa",
                                  "placeType": "CONTINENT"
                              },
                              {
                                  "locationId": 1,
                                  "name": "Welt",
                                  "placeType": null
                              }
                          ]
                      }
                  ]
              }
          },
  
  </code></pre>