Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有^.*(?=.{10,})(?=.*\d).*$正则表达式验证器的正则表达式模式。如何更改验证器以禁止字符串开头和结尾的空格。
^.*(?=.{10,})(?=.*\d).*$
尝试将您的正则表达式更改为:
^\S*(?=.{10,})(?=.*\d)\S*$
\S表示除空白字符之外的任何内容。
\S
试试这个:
^\s*(.*)\s*$? \s*(.*)
这应该有效:
^\S(?=.*\d)(?=.{10,})(.*\S)?$