我正在做一个项目。我仅将[a-zA-Z]+
用于字母输入。我想限制用户仅以(BS-或MSC-)开始,然后输入任何内容
下面是输入类型:
<input type="text" class="form-control" placeholder="Enter Degree Name Example BS-IT" name="degree" required pattern="[a-zA-Z]+" title="Example BS-IT">
答案 0 :(得分:1)
您需要将BS-
和MSC-
条件添加到正则表达式中。如:
(BS-|MSC-)[-a-zA-Z]+