How do you get a string not containing a specific group?

```
(?:[0-9-+*/()x]|abs|pow|ln|pi|e|a?(sin|cos|tan)h?)+
```

Above string is the expression for mathematical expressions. How do you get the string that is not a mathematical expression?

Example:`WIDTH+LENGTH*abs(2)`

Supposed Output: `WIDTH`

`LENGTH`

# Best How To :

You can use the regex in a negative look-ahead and then add a `\w`

shorthand class to match alphanumeric symbols, or `[a-zA-Z]`

with `\b`

word boundaries:

```
(?![0-9-+*/()x]|abs|pow|ln|pi|e|a?(?:sin|cos|tan)h?)\b[a-zA-Z]+\b
```

See regex demo

Since we are only allowing letters with `[a-zA-Z]`

, we can reduce this further to

```
(?!x|abs|pow|ln|pi|e|a?(?:sin|cos|tan)h?)\b[a-zA-Z]+\b
```

See another demo