Created
January 24, 2022 14:13
-
-
Save yangwao/24f1e3dddc39f9bc54af315989db86fe to your computer and use it in GitHub Desktop.
RegExp Kusama Address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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