I want a regex which allows `.-`,numeric and lowercase in string 

but those special characters should not come side by side,first,last

I tried this `var re = /^[a-z0-9]+(-.[a-z0-9]+)*$/;` but this allows special characters side by side

the following should be true

`foo.bar`
`foo-bar`
`foo.bar-test`
`f-b-123`

and the following should be false

`foo..bar`
`foo.-bar`
`foo--bar`
`-f`
`f-`

any help appreciated thanks