Post
Topic
Board Announcements (Altcoins)
Re: [ANN][CLAM] CLAMs, Proof-Of-Chain, Proof-Of-Pearl
by
inkha
on 18/10/2016, 11:15:12 UTC
does anybody know how to validate a CLAM address with PHP?

This works... using the regex from Nixsy:

Code:
$regex = "/^[x][a-km-zA-HJ-NP-Z0-9]{26,33}$/";
if (preg_match($regex, "xWEWfhF9hDvKksvWgFj6kmseLYShZG9Kx8")) {
    // match success
    echo "Found a match!";
} else {
    // If preg_match() returns false, then the regex does not
    // match the string
    echo "The regex pattern does not match. :(";
}

Helpful, saved aswell thanks!

Code:
function validateAddress($address){
  $regex = "/^[x][a-km-zA-HJ-NP-Z0-9]{26,33}$/";
  if (preg_match($regex, $address)) {
      // match success
      return true;
  } else {
      // If preg_match() returns false, then the regex does not
      // match the string
      return false;
  }
}
I Have saved this to my snippets folder, Thanks dude.