golang ethereum address regexp check
https://docs.etherniti.org/architecture/optimizations/address-validation/
package main
import (
"fmt"
"regexp"
)
var (
re := regexp.MustCompile("^0x[0-9a-fA-F]{40}$")
)
func IsValidAddress(v string) bool {
return re.MatchString(v)
}
func main() {
fmt.Println(IsValidAddress("0x323b5d4c32345ced77393b3530b1eed0f346429d")) // true
fmt.Println(IsValidAddress("0xXYZb5d4c32345ced77393b3530b1eed0f346429d")) // false
}