正则表达式示例,用于输入在开头和结尾接受一个或多个空格,但不在中间



regexp=/^([a-zA-Z0-9@_\s.#]+($/;我试过这个,但不起作用

这样

的东西可以帮助你吗?

// no spaces in the middle at all
regexp=/^[ ]{,2}[^ ]+?[ ]{,2}$/
// no two spaces in the middle, one is ok
regexp=/^[ ]{,2}[^ ]+?(?!  )[^ ][ ]{,2}$/

最新更新