Jump to content

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


 Share

Go to solution Solved by mikell,

Recommended Posts

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
Link to comment
Share on other sites

  • Solution

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...