Solved

Like operator to determine if alphanumeric

Posted on 2006-10-25
6
337 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
[X]
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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

735 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