Question: I am trying to create a regular expression to separate each word from `.` (dot) in JavaScript.

```
function myFunction() {
  var url = "in.k1.k2.k3.k4.com"
  var result
  var match
  if (match = url.match(/^[^\.]+\.(.+\..+)$/)) {
    console.log(match);
  }
}

```

Actual result is:

```
match[0] : in.k1.k2.k3.k4.com
match[1] : k1.k2.k3.k4.com

```

Expected result is:

```
match[0] : in.k1.k2.k3.k4.com
match[1] : k1.k2.k3.k4.com
match[2] : k2.k3.k4.com
match[3] : k3.k4.com
match[4] : k4.com

```

Please help me to create perfect regular expression.

Answer: 
The way your code is written, it will append score dictionaries instead of adding an object in an array of scores.

If you check the output file score.json it will look like {...}{...}{...} whereas it should be like [{...},{...},{...}]
You can read the file line by line, every line will contain a valid JSON object:

```
with open('score.json') as fp:
    for line in fp:
        data = json.loads(line)
        # do something with data

```

Or if you need everything in one object:

```
with open('score.json') as fp:
    data = []
    for line in fp:
        data.append(json.loads(line))

```