Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 89f1469

Browse files
committedMar 11, 2025·
[Fix] Fixed product key validation algo
1 parent c7ab1d9 commit 89f1469

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎Elements/AutoUnattend/ProductKey/ProductKey.vb

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ Namespace Elements
2828
Public Shared Function ValidateProductKey(key As String) As ProductKey
2929
DynaLog.LogMessage("Validating product key " & Quote & key & Quote & "...")
3030
Dim pKey As New ProductKey()
31-
If Regex.Match(key, "^([2346789BCDFGHJKMPQRTVWXY]{5}-){4}[2346789BCDFGHJKMPQRTVWXY]{5}$").Value <> "" Then
32-
DynaLog.LogMessage("Regex match completed and returned values. Key is valid in syntax.")
31+
If Regex.IsMatch(key, "^([A-Z0-9]{5}-){4}[A-Z0-9]{5}$") Then
32+
DynaLog.LogMessage("Regex has matches. Key is valid in syntax.")
3333
pKey.Valid = True
3434
pKey.Key = key
3535
Else
36-
DynaLog.LogMessage("Regex match completed but didn't return any values. Key is invalid in syntax.")
36+
DynaLog.LogMessage("Regex does not have matches. Key is invalid in syntax.")
3737
pKey.Valid = False
3838
pKey.Key = ""
3939
End If

0 commit comments

Comments
 (0)
Please sign in to comment.