Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 单一输入类型下的多重验证_Regex_Html_Validation_Input - Fatal编程技术网

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]+