jeantje Posted February 11, 2009 Share Posted February 11, 2009 I have a question if i use a hex like 39D54BDB00AC76FD794C382C36FAE27403 and i need to compare it with 39??4BDB00AC76F??94??82C??FAE27403 and that is valid how can i use the ?? as a key for any hex character Link to comment Share on other sites More sharing options...
Authenticity Posted February 11, 2009 Share Posted February 11, 2009 (edited) Dim $sKey1 = '39D54BDB00AC76FD794C382C36FAE27403' Dim $sKey2 = '39[A-Z0-9]+4BDB00AC76F[A-Z0-9]+94[A-Z0-9]+82C[A-Z0-9]+FAE27403' If StringRegExp($sKey1, $sKey2) Then MsgBox(0x40, 'Title', 'Success') Else MsgBox(0x10, 'Title', 'Failure') EndIf $sKey1 = '39D54BDB00AC76FD794C382C36FAE274' $sKey2 = '39[A-Z0-9]+4BDB00AC76F[A-Z0-9]+94[A-Z0-9]+82C[A-Z0-9]+FAE27403' If StringRegExp($sKey1, $sKey2) Then MsgBox(0x40, 'Title', 'Success') Else MsgBox(0x10, 'Title', 'Failure') EndIf $sKey1 = '39D54BDB00AC76FD794C382C36FAE2740300' $sKey2 = '39[A-Z0-9]+4BDB00AC76F[A-Z0-9]+94[A-Z0-9]+82C[A-Z0-9]+FAE27403' If StringRegExp($sKey1, $sKey2) Then MsgBox(0x40, 'Title', 'Success') Else MsgBox(0x10, 'Title', 'Failure') EndIfYou can also split the string to '' which will split the string for each character..Edit: You can try something like this if you want it to be at the start and end of the string as well as restricting the [A-Z0-9] to only two characters:Dim $sKey2 = '^39[A-Z0-9]{2}4BDB00AC76F[A-Z0-9]{2}94[A-Z0-9]{2}82C[A-Z0-9]{2}FAE27403$' Edited February 11, 2009 by Authenticity Link to comment Share on other sites More sharing options...
jeantje Posted February 12, 2009 Author Share Posted February 12, 2009 Dim $sKey1 = '39D54BDB00AC76FD794C382C36FAE27403' Dim $sKey2 = '39[A-Z0-9]+4BDB00AC76F[A-Z0-9]+94[A-Z0-9]+82C[A-Z0-9]+FAE27403' If StringRegExp($sKey1, $sKey2) Then MsgBox(0x40, 'Title', 'Success') Else MsgBox(0x10, 'Title', 'Failure') EndIf $sKey1 = '39D54BDB00AC76FD794C382C36FAE274' $sKey2 = '39[A-Z0-9]+4BDB00AC76F[A-Z0-9]+94[A-Z0-9]+82C[A-Z0-9]+FAE27403' If StringRegExp($sKey1, $sKey2) Then MsgBox(0x40, 'Title', 'Success') Else MsgBox(0x10, 'Title', 'Failure') EndIf $sKey1 = '39D54BDB00AC76FD794C382C36FAE2740300' $sKey2 = '39[A-Z0-9]+4BDB00AC76F[A-Z0-9]+94[A-Z0-9]+82C[A-Z0-9]+FAE27403' If StringRegExp($sKey1, $sKey2) Then MsgBox(0x40, 'Title', 'Success') Else MsgBox(0x10, 'Title', 'Failure') EndIf You can also split the string to '' which will split the string for each character.. Edit: You can try something like this if you want it to be at the start and end of the string as well as restricting the [A-Z0-9] to only two characters: Dim $sKey2 = '^39[A-Z0-9]{2}4BDB00AC76F[A-Z0-9]{2}94[A-Z0-9]{2}82C[A-Z0-9]{2}FAE27403$' Thank you very much Authenticity Greetings Jeantje 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