Regex 单一输入类型下的多重验证

Regex 单一输入类型下的多重验证,regex,html,validation,input,Regex,Html,Validation,Input,我正在做一个项目。我只对字母输入使用了[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"> 您需要将BS-和MSC-标准添加到正则表达式

我正在做一个项目。我只对字母输入使用了
[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">

您需要将
BS-
MSC-
标准添加到正则表达式中。例如:

(BS-|MSC-)[-a-zA-Z]+