Hi im working in a javascript application and need help figuring out this regex

I have a series of strings. they are dynamic but do have a set pattern.

```
name eq 'abc'
id in 'def'
key | operator | value

```

then i have a modifier 'has'

```
has name eq 'abc'
!has id
has address eq '123 sesame street'
|modifier | key | operator | value

```

I am able to extract the modifier and key no problem with this regex

```
new RegExp(/(^(\s*!?has\s+)?([^\s]+)|(^\s*[^\s]+))/i)

```

but the issue comes in when I have a key that is the same as a modifier

```
has eq '123'

```

the regexp above returns 'has eq' where i only need 'has'

```
has has eq '123'

```

the above returns properly 'has has'

there is a large number of operators to handle but they are a set value

any help would be appreciated