简体   繁体   中英

Regexp with letters and -

I need a regexp with letters and - to use as pattern validate of an input type text, for example:

 <input type="text" name="name" id="name" class="form-control" placeholder="name form" pattern="[A-Za-z-]" required="required"> 

But it still validate also other characters when i fill and sumbit form.

您可以使用以下模式( [A-Za-z\\-]+ )检查整个输入:

<input type="text" name="name" id="name" class="form-control" placeholder="name form" pattern="[A-Za-z\-]+" required="required">

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