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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Test for repeat characters? 1

Status
Not open for further replies.

RhythmAddict112

Programmer
Jun 17, 2004
625
US
Hi All,
Quick question. I need to create a JS function that will test a string for repeat characters. Basically, it can return false if any characters in the string are repeated, true if not.

just to clarify, that'd mean no character can be repeated in the string, as opposed to back to back.
So the word "dad" would return false, since it has two d's.
I was looking for an easy (regEx?) way to do this, but since I don't really even know regEx that does make things a bit challenging :)

Any of you gurus have any suggestions for me?

Thanks in advance1

 
You're quick! I was just going to post and edit my original post.

My requirements say "no one character can repeat more than twice"

So. I'm assuming my example and explanation were incorrect (sorry!)

I can't repeat the same character more than twice...which I guess means that I can repeat a character as many times I want in a string, just not consecutively. so..

"aaaaa" would not be valid, whereas "ajajajaj" would.

Thank you very much for your help!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top