sciosalvi Posted February 27, 2014 Share Posted February 27, 2014 (edited) Hey guys, This is pretty weird. For a web application, I need to pre validate different crypto currency addresses. Of course, after this initial check, I'll do a proper validation with the checksum, but I first want to find out the crypto currency and do a simple discarding. Anyway, here's part of the code. Only the first regex work, the one for BTC. The 2 other don't. All 3 work in notepad++. Can anyone tell why? If StringRegExp($address, "^[13][1-9A-HJ-NP-Za-km-z]{26,33}") = 1 Then $crypto_type = BTC ElseIf StringRegExp($address, "^L[a-zA-Z0-9]{26,33}") = 1 Then $crypto_type = LTC ElseIf StringRegExp($address, "(D[1-9a-z]{20,40})") = 1 Then $crypto_type = DOGE EndIf Thanks Edit: here are one example for each currency, if anyone would be willing to try something out. BTC: 1FfmbHfnpaZjKFvyi1okTjJJusN455paPH LTC: LWFnkMtKD5Kur3dyD5jxij6Bnjm6L8F7rN DOGE: DRJK35qeLPDPnAgVxJ9mBPHHkmVBY4j9PV Edited February 27, 2014 by sciosalvi Link to comment Share on other sites More sharing options...
Solution mikell Posted February 27, 2014 Solution Share Posted February 27, 2014 (edited) Works for me ;$address = '1FfmbHfnpaZjKFvyi1okTjJJusN455paPH' ;$address = 'LWFnkMtKD5Kur3dyD5jxij6Bnjm6L8F7rN' $address = 'DRJK35qeLPDPnAgVxJ9mBPHHkmVBY4j9PV' Local $crypto_type If StringRegExp($address, "^[13][1-9A-HJ-NP-Za-km-z]{26,33}") Then $crypto_type = "BTC" ElseIf StringRegExp($address, "^L[a-zA-Z0-9]{26,33}") Then $crypto_type = "LTC" ElseIf StringRegExp($address, "(D[1-9a-zA-Z]{20,40})") Then $crypto_type = "DOGE" EndIf msgbox(0,"", $crypto_type) BTW there was a A-Z missing in the third one Edited February 27, 2014 by mikell sciosalvi 1 Link to comment Share on other sites More sharing options...
sciosalvi Posted February 27, 2014 Author Share Posted February 27, 2014 Upssss, had another small issue in the rest of the code, thank you for finding that missing part in the regex!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now