I am trying to create a regular expression to match any git read + write URL structure (not just GitHub), and I wanted to check if I got the correct expression correctly. This is what I still have
([A-Za-z0-9]+@|http(|s)\:\/\/)([A-Za-z0-9.]+)(:|/)([A-Za-z0-9\/]+)(\.git)?
This regular expression matches all of the following URLs
git@github.com:user/project.githttps://github.com/user/project.githttp://github.com/user/project.gitgit@192.168.101.127:user/project.githttps://192.168.101.127/user/project.githttp://192.168.101.127/user/project.githttp://192.168.101.127/user/project
And others, such as top-level domains and domains with the same name (http: // server /). Are there other url structures I should keep in mind? Also, is there a shorter way of writing an existing regular expression that I have?
source
share