I am trying to validate a querystring coming from an email activation link, written in Classic ASP.
The querystring input contains numbers, letters and 2 forward slashes. Like this: G3hEus87YK/6738/HE347sxThH
and I need to validate it, checking that only numbers, letters and slashes have been used.
The numbers in between the slashes could be 1-9 digits long, here I used 4 as an example but there are always 10 alphanumerical characters before the slash and 10 after.
I have done this so far, that will run the check, but I'm not sure which pattern to give it!
Function validateToken(token)
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Pattern = "???????????"
validateToken = regEx.Test(Trim(Request.QueryString("token")))
End Function
My attempt for numbers and letters only would be, [A-z][0-9]
, but looking for 2 slashes confuses me. How can I look for slashes too?
I suppose if I wrote the pattern in pure English, it would read:
- 10 alphanumerical characters, any case.
- A forward slash
- Numbers, 1-9 digits long
- A forward slash
- 10 alphanumerical characters, any case.