47
Does anyone know how to write a regexp that only allows a-zA-Z0-9.- (letters, numbers, dots, and dash) BUT that never starts or ends with a dot or dash ?
I tried this one :
/^[^.-][a-zA-Z0-9.-]+[^.-]$/
... but if I write something like "john@", it works, and I don't want to because @ is not allowed.