^[A-Z0-9]*[ _][A-Z0-9]*$
space cannot be accepted either at the beginning or end.
space cannot be accepted at all instead of the value.
allow numbers and characters in the start and end.
allow hyphens in the middle not mandatory
所有这些值都认可的价值观如何写一个正则表达式的JavaScript valiadation
12345
ABC-12345
MM 1.8.10
530715 HS 9JAXXX4100
020-59898
HLXU1234
但是当我键入ABC BCD。它说,这是不正确的匹配
又有什么问题呢? – 2012-02-14 21:38:31
当我键入ABC BCD。它说这是不正确的匹配 – Someone 2012-02-14 21:39:44
*“允许在中间的连字符不是强制性的”*究竟什么可以或不在中间?你是否需要至少一个字符作为开始和结束部分? – 2012-02-14 21:45:31