Initial commit

This commit is contained in:
lash
2025-01-12 08:17:29 +00:00
commit ded01e8dd0
5 changed files with 73 additions and 0 deletions

16
phone/phone.go Normal file
View File

@@ -0,0 +1,16 @@
package phone
import (
"regexp"
)
// Define the regex patterns as constants
const (
phoneRegex = `^(?:\+254|254|0)?((?:7[0-9]{8})|(?:1[01][0-9]{7}))$`
)
// IsValidPhoneNumber checks if the given number is a valid phone number
func IsValidPhoneNumber(phonenumber string) bool {
match, _ := regexp.MatchString(phoneRegex, phonenumber)
return match
}