Link to home
Start Free TrialLog in
Avatar of bertino12
bertino12

asked on

Like operator to determine if alphanumeric

I am writing a condition to determine if a letter in a string is alphanumeric. It seems to be failing.

If Mid(strNew, i, 1) Like ("[A-Z]") Or Mid(strNew, i, 1) Like ("[a-z]") Or Mid(strNew, i, 1) Like ("#") Then

I keep falling into this condition even if the character is "[" or "("

This doesnt seem to be working. Is this the wrong syntax for find alpha numerics in classic ASP?
ASKER CERTIFIED SOLUTION
Avatar of kevp75
kevp75
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry, that should be

strTested = objRegExp.Test(variable) 'for a boolean value
Avatar of jitganguly
jitganguly

How about

If asc(Mid(strNew, i, 1) ) > 65 or  asc(Mid(strNew, i, 1) )< 127 Then
Avatar of bertino12

ASKER

This seems to work beautifully. thanks.

elseif objRegExp.Test(Mid(strNew, i, 1)) = true then

I am parsing through a string(from a textbox a user puts in search strings) and inserting wildcard symbols to words for an oracle query.



ahh...

glad I could help