How to write regex for following strings, have no space or multi space either pre or post.

```
"any"
"any4"
"any6"
" any "
" any4 "
" any6 "
"  any  "
"  any4  "
"  any6  "

```

I have tried `"any[4,6]{0,1}$"`, but that works with only the first three strings.