Sign in to follow this  
Followers 0
sciosalvi

Need to match 3 regex, all 3 work in notepad++, only one in Autoit.

3 posts in this topic

#1 ·  Posted (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 by sciosalvi

Share this post


Link to post
Share on other sites

#2 ·  Posted (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 by mikell
1 person likes this

Share this post


Link to post
Share on other sites

Upssss, had another small issue in the rest of the code, thank you for finding that missing part in the regex!!!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0