• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

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?
0
bertino12
Asked:
bertino12
  • 3
1 Solution
 
kevp75Commented:
i'm curious as the purpose of this....

it seems like you may want to tryout Regular Expressions for this...something like

set objRegExp = New RegExp
objRegExp.Pattern = "^([a-zA-Z0-9])"
objRegExp.Test(variable) 'for a boolean value
set objRegExp = nothing
0
 
kevp75Commented:
sorry, that should be

strTested = objRegExp.Test(variable) 'for a boolean value
0
 
jitgangulyCommented:
How about

If asc(Mid(strNew, i, 1) ) > 65 or  asc(Mid(strNew, i, 1) )< 127 Then
0
 
bertino12Author Commented:
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.



0
 
kevp75Commented:
ahh...

glad I could help
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now