1

I want to validate any string that contains çÇöÖİşŞüÜğĞ chars and starting at least 5 chars.String to validate can contain spaces.RegEx must validate like "asd Çğ ğT i" for example.

Any reply will helpful. Thanks.

3
  • Wow I completely don't know what "yiyle" means, and I'm usually pretty good at guessing. Commented Mar 24, 2011 at 14:16
  • It's kind of difficult to understand what you want that regex to do. Maybe you could clarify your question a little bit? Commented Mar 24, 2011 at 14:20
  • Don't forget to mark the question as accepted (check the tick under the answer you think is the best) Commented Mar 24, 2011 at 15:59

1 Answer 1

3

You can use escape sequences of the form

\uXXXX

where each "X" can be any hex digit. Thus:

\u0020

is the same as a plain space character, and

\u0041

is upper-case "A". Thus you can encode the Unicode values for the characters you're interested in and then include them in a regex character class. To make sure the string is at least five characters long, you can use a quantifier in the regex.

You'll end up with something like:

var regex = /^[A-Za-z\u00nn\u00nn\u00nn]{5,}$/;

where those "00nn" things would be the appropriate values. As to exactly what those values are, you should be able to find them on a reference site like this one or maybe this one. For example I think that "Ö" is \u00D6. (Some of your characters are in the Unicode Latin-1 Supplement, while others are in Latin Extended A.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.