Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help in regular expression 2

Status
Not open for further replies.

thelordoftherings

Programmer
May 16, 2004
616
IL
Hello,

I would like to test a String with regexp like this: The String can't contain numbers and the letters a-z or A-Z.
Which regexp String should I write?
 
Maybe you should post a set of example strings which should fail the test and some which should pass.

I thought this was an excellent suggestion by Tim, and it would make answering your question 100x easier.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
[banghead]
 
kaht said:
I thought this was an excellent suggestion by Tim, and it would make answering your question 100x easier.
Yes, particularly now that the question has changed for the second time.

lordoftherings123 - can you explain what exactly it is that you want to do, with examples please.
 
ishnid's latest answer solved my problem completley.
It just that this answer raised a thought in my head how to do it for the 2nd 3rd character ect. and I just wanted to see if understood this regexp method.
I aplogize if it sounded like it didn't solve my problem since it did....
 
Ok - the last regexp you posted will check both the first *and* second characters. If you want to check a specific character, you can use the following (replace the 2 with the number of characters you want there to be *before* the one you're trying to check. i.e. this will check the third character in the string)
Code:
.{2}[^a-zA-Z0-9].+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top