mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Improve regexes
This commit is contained in:
parent
8dd47e2cbb
commit
0c94ea9c7c
@ -43,8 +43,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileIDRegexes = [...]*regexp.Regexp{
|
var fileIDRegexes = [...]*regexp.Regexp{
|
||||||
regexp.MustCompile("^https?:\\/\\/minecraft\\.curseforge\\.com\\/projects\\/(.+)\\/files\\/(\\d+)$"),
|
regexp.MustCompile("^https?:\\/\\/minecraft\\.curseforge\\.com\\/projects\\/(.+)\\/files\\/(\\d+)"),
|
||||||
regexp.MustCompile("^https?:\\/\\/(?:www\\.)?curseforge\\.com\\/minecraft\\/mc-mods\\/(.+)\\/download\\/(\\d+)$"),
|
regexp.MustCompile("^https?:\\/\\/(?:www\\.)?curseforge\\.com\\/minecraft\\/mc-mods\\/(.+)\\/files\\/(\\d+)"),
|
||||||
|
regexp.MustCompile("^https?:\\/\\/(?:www\\.)?curseforge\\.com\\/minecraft\\/mc-mods\\/(.+)\\/download\\/(\\d+)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
func getFileIDsFromString(mod string) (bool, int, int, error) {
|
func getFileIDsFromString(mod string) (bool, int, int, error) {
|
||||||
@ -63,8 +64,8 @@ func getFileIDsFromString(mod string) (bool, int, int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var modSlugRegexes = [...]*regexp.Regexp{
|
var modSlugRegexes = [...]*regexp.Regexp{
|
||||||
regexp.MustCompile("^https?:\\/\\/minecraft\\.curseforge\\.com\\/projects\\/([^\\/]+)$"),
|
regexp.MustCompile("^https?:\\/\\/minecraft\\.curseforge\\.com\\/projects\\/([^\\/]+)"),
|
||||||
regexp.MustCompile("^https?:\\/\\/(?:www\\.)?curseforge\\.com\\/minecraft\\/mc-mods\\/([^\\/]+)$"),
|
regexp.MustCompile("^https?:\\/\\/(?:www\\.)?curseforge\\.com\\/minecraft\\/mc-mods\\/([^\\/]+)"),
|
||||||
// Exact slug matcher
|
// Exact slug matcher
|
||||||
regexp.MustCompile("^[a-z][\\da-z\\-]{0,127}$"),
|
regexp.MustCompile("^[a-z][\\da-z\\-]{0,127}$"),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user