匹配脚本的输入模式开头
Matching an input pattern beginning of script
我正在尝试仅将 GitHub 个 URL 与以下输入标记匹配:
<input type="url" id="repoUrl" title="Must be a full URL to a GitHub repository" pattern="^https:\/\/github\.com\/" required>
在 regex101 中,这个精确模式匹配所有以“https://github.com" which is what I want, but the problem is that when I call the checkValidity()
method on that input, it only says it's valid if the input is only "https://github.com”开头的字符串。
我需要更改什么才能使此正则表达式在 regex101 中如何工作?
尝试在模式末尾添加 .*
pattern="^https:\/\/github\.com\/.*"
我正在尝试仅将 GitHub 个 URL 与以下输入标记匹配:
<input type="url" id="repoUrl" title="Must be a full URL to a GitHub repository" pattern="^https:\/\/github\.com\/" required>
在 regex101 中,这个精确模式匹配所有以“https://github.com" which is what I want, but the problem is that when I call the checkValidity()
method on that input, it only says it's valid if the input is only "https://github.com”开头的字符串。
我需要更改什么才能使此正则表达式在 regex101 中如何工作?
尝试在模式末尾添加 .*
pattern="^https:\/\/github\.com\/.*"