Solved

Like operator to determine if alphanumeric

Posted on 2006-10-25
6
339 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

628 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