Question: There are any documentation for this? I've checked many formulas and algorithms but didn't find an explicit definition how they get the speed provided in Geolocation object.

Answer: 
You just need to add `^` (start of string) & `$` (end of string):

```
/^(domain1.com|domain2.com)$/

```

```js
console.log(
new RegExp('^(domain1.com|domain2.com)$', 'igm').test('ci.domain1.com'),
new RegExp('^(domain1.com|domain2.com)$', 'igm').test('domain1.com'),
new RegExp('^(domain1.com|domain2.com)$', 'igm').test('domain2.com')
)
```
With anchors and optional `www` matching at the start you can use this regex:

```
/^(?:www\.)?(?:domain1|domain2)\.com$/i

```

Also dot before `com` needs to be escaped to avoid matching any character.

[RegEx Demo](https://regex101.com/r/A2IOJE/3)

**RegEx Breakup:**

* `^`: Start
* `(?:www\.)?`: Match optional `www` at the start of domains
* `(?:domain1|domain2)`: Match `domain1` or `domain2`
* `\.com`: Match literal text `.com`
* `$`: End