package utils import ( "regexp" "github.com/gofiber/fiber/v2" ) func GetQueryOrFormValue(c *fiber.Ctx, key string) string { if c.Method() == "POST" { return c.FormValue(key) } else { return c.Query(key) } } func Sanitize(str string, strip string) string { nonAlphanumericRegex := regexp.MustCompile(`[^a-zA-Z]+`) nonAlphaRegex := regexp.MustCompile(`[^a-zA-Z0-9]+`) if strip == "alpha" { return nonAlphaRegex.ReplaceAllString(str, "") } else if strip == "alphanumeric" { return nonAlphanumericRegex.ReplaceAllString(str, "") } return "" }