troubleshooting Question

Delphi : how to know if a string variable contains only a..z, A..Z, 0-9,-, _

Avatar of starhu
starhu asked on
6 Comments2 Solutions11189 ViewsLast Modified:

I have a string variable S.

I need to know  if this S consists only of characters of a..z, A..Z, 0-9,-, _    or it contains other characters as well.

For example:
 'skdfkfkAkd32-k33' would return True
 '5_-kksdfTEkd5-' would return True
'DS3Á323-3kd' would return False
'23Kskdf-k!xx' would return False

I can do it with Pos, but the code would be too long to check every character.
The best solution would be something like regexpin MySql.

Thank you
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros