Question: I am generating a regular expression that can contain any *letters* or numbers or an underscore `[a-zA-Z0-9_]` but not contain words that exactly match `log`, `login` and lastly `test`.

Can anybody help me with this?

Answer: 
You can use this negative lookahead regex:

```
\b(?!log(?:in)?|test)\w+

```

[RegEx Demo](https://regex101.com/r/gQ7cL4/1)

`(?!log(?:in)?|test)` is negative lookahead, that will fail the match if any given words `log,login,test` are present.
I think the below regular expression should do the trick

```
^((?!log|login|test)[a-zA-Z0-9_])*$

```