Skip to content

Instantly share code, notes, and snippets.

@yangwao
Created January 24, 2022 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangwao/24f1e3dddc39f9bc54af315989db86fe to your computer and use it in GitHub Desktop.
Save yangwao/24f1e3dddc39f9bc54af315989db86fe to your computer and use it in GitHub Desktop.
RegExp Kusama Address
// match Substrate/KSM address, experimental
// Warning: Do not use regular expressions (regex) to validate addresses.
// Always verify using the prefix and checksum of the address.
// Substrate API Sidecar provides an accounts/{accountId}/validate path that returns a boolean isValid response for a provided address.
// If you want to validate addresses in another way, see the validation documentation.
const lookupForAddress = /kodadot.xyz\/transfer\/\?target=\w[a-zA-Z0-9]{46}\b/g;
const matchAddress = /\w[a-zA-Z0-9]{46}\b/g;
const destination_address = matchAddress.exec(lookupForAddress.exec(pr_status.data.body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment