简体   繁体   中英

pattern for regular expression that will eliminate empty string

I am using zurb foundation and I would like avoid to submit answer consist only with empty spaces.

how can I write pattern that will allow all letters, numbers, spaces and signs (, ; . !) but will not pass empty string fr " "

this one is ok but works only for one word:

<textarea placeholder=""  id="answer-add" required  pattern="^[a-zA-Z0-9]+$"></textarea>

如果您要避免的唯一事情是获得一串空格,则可以使用以下命令:

<textarea placeholder=""  id="answer-add" required  pattern="^[^\s]*$"></textarea>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM