2

I'm trying to match only GitHub URLs with the following input tag:

<input type="url" id="repoUrl" title="Must be a full URL to a GitHub repository" pattern="^https:\/\/github\.com\/" required>

In regex101 this exact pattern is matching all strings that start with "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".

What do I need to change to make this regex work how it works in regex101?

Adam McGurk
  • 186
  • 1
  • 19
  • 54

1 Answers1

2

try to add .* in the end of a pattern

pattern="^https:\/\/github\.com\/.*"
Yosef Tukachinsky
  • 5,570
  • 1
  • 13
  • 29