Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Like operator to determine if alphanumeric

Posted on 2006-10-25
6
336 Views
Last Modified: 2008-02-01
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
Comment
Question by:bertino12
  • 3
6 Comments
 
LVL 25

Accepted Solution

by:
kevp75 earned 50 total points
ID: 17804142
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
 
LVL 25

Expert Comment

by:kevp75
ID: 17804145
sorry, that should be

strTested = objRegExp.Test(variable) 'for a boolean value
0
 
LVL 20

Expert Comment

by:jitganguly
ID: 17804217
How about

If asc(Mid(strNew, i, 1) ) > 65 or  asc(Mid(strNew, i, 1) )< 127 Then
0
 

Author Comment

by:bertino12
ID: 17804269
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
 
LVL 25

Expert Comment

by:kevp75
ID: 17804985
ahh...

glad I could help
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question