I'm currently writing a very specific regex for a firstname field, that has several requirements. One of them is that spaces are not allowed before or after hyphens. For this, I have used a negative lookahead:

```
(?!.*(\s\-))

```

as part of the regex:

```
^(?!ß)(?!.*(\s\-))(?!(.)\1{2})(?!.*\s{2})(?!.*\'{2})(?!.*\-{2})[a-zA-ZßöüäÜÖÄ\s\-\']{2,30}(?<![\s\-])$

```

It does return a mismatch for:

```
asdf -asdf

```

but not for:

```
asdf- asdf

```

The latter also need to return an error. What am I missing?