^[^ ]([\w- \.]+)[^ ]$
[^ ]
= cannot start or end with space
([\w- .]+)
= all characters allowed (or in this case, \w, hyphen, space and dot)
matches:
ABC BCD
1
solved How to write a regular expression for javascript valiadation [closed]
^[^ ]([\w- \.]+)[^ ]$
[^ ]
= cannot start or end with space
([\w- .]+)
= all characters allowed (or in this case, \w, hyphen, space and dot)
matches:
ABC BCD
1
solved How to write a regular expression for javascript valiadation [closed]