Q: RegExp for Cyrillic+minimum 3 letters+without numbers and space+non repeatable at the end I do have the following RegExp in the current web application.
function myCyrillicValidator(text){
    return XRegExp("^\\p{Cyrillic}+$").test(text);
}

As you can see I use XRegExp javasciprt library. Currently, this regxep checks if its cyrillic. I want to extend it and to check:


*

*It's Cyrillic

*It's minimum 3 letters

*It doesnt have space

*The last letters doesnt repeat, i.e Gabenn <- is wrong, Moneyy <- is wrong, beucase the last 2 letters are repeating

*First letter is capital


I tried few online RegExp tester/builders to build on top of the current rule. But none of them showed me that the current regexp is working correctly. But surprisingly, its working in the webapp, but not in the online testers.
XregxExp version is 2.0.0 if it does matter

A: Use the following regex:
XRegExp("^(?=\\p{Lu})(?!.*(.)\\1$)\\p{Cyrillic}{3,}$")

See the regex demo.
Details:


*

*^ - start of string anchor

*(?=\\p{Lu}) - the first letter must be an uppercase letter

*(?!.*(.)\\1$) - the string should not end with 2 identical chars

*\\p{Cyrillic}{3,} - the string should only consist of 3 or more Cyrillic letters

*$ - end of string anchor




function myCyrillicValidator(text){
    return XRegExp("^(?=\\p{Lu})(?!.*(.)\\1$)\\p{Cyrillic}{3,}$").test(text);
}

console.log(myCyrillicValidator("Ва"));    // => false 
console.log(myCyrillicValidator("вася"));  // => false
console.log(myCyrillicValidator("Васяя")); // => false
console.log(myCyrillicValidator("Вася"));  // => true
<script src="https://cdnjs.cloudflare.com/ajax/libs/xregexp/2.0.0/xregexp-all-min.js"></script>


