Question: I'm trying to change default language of website from "en" to "jp".

The webpage both contain english and japanesse. 

I can't understand japanesse. But chrome translatation always suggest english translation (english to other language) first.

And I have to chage website language to japanesse to translation.

I think change website's default language can help. 

I figure chrome extension like Tampermonkey can override attribute of html.

Here's my code. 

```
// ==UserScript==
// @name default_lang
// @description change site language from en to jp
// @include         https://*siteaddress.com/*
// ==/UserScript==

document.body.innerHTML= document.body.innerHTML.replace(/xml:lang=\"en\" lang=\"en\"/g, "xml:lang=\"jp\" lang=\"jp\"");

```

Hope you could help me.

Answer: 
Here's how I might proceed:

```js
const parse = (str) => 
  str .trim() .split (/\s*\n\s*/)
    .map (s => s .split (' | ') .map (s => s .split (' : ')))
    .map (row => row .map (([k, v]) => [k .replace (/\s+/, ''), isNaN (v) ? v : Number(v)]))
    .map (Object .fromEntries)

const str = `
Segment Id : 82394 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (Permission)_01 | Segment Count : 0
Segment Id : 82395 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_02 | Segment Count : 0
Segment Id : 82395 | Segment Name : SPA FIAT MAR 2020 LKADCLAKSC DEM (LeadYoung)_02 | Segment Count : 0
`

console .log (parse (str))
```

```css
.as-console-wrapper {min-height: 100% !important; top: 0}
```

We start by trimming off any excess from the string, then split it on line-breaks (plus any space around them). Then for each row, we split the fields on `|` and split the keys from the values on `:`. In the next line, each key-value pair is converted: we remove spaces from the keys, and we convert values that look like numbers to numbers. (You might need something more sophisticated if there are more fields or if, for instance, the `count` is supposed to be numeric but the `id` isn't.) Finally, each row is converted into an object with `Object .fromEntries`.

This all assumes that you actually have line-breaks as per the comments. If not, the initial split might need to be more sophisticated.
I recommed using `String.split()` method. The documentation is here [Javascript Split](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split).
To illustrate, what it does:

```js
const string = "Name | Value";
var results = string.split("|");
console.log(results); // Array: ["Name ", " Value"]
```

In your case, you can start splitting the string by "\n" (Newline) then "|" and finally ":".

Hope this helps you with your problem!