I am using the autocompleter jquery-textcomplete in my web app. It's working fine for English and Russian letters. But it is not working for certain special letters such as "ҷ".
Code:
$('.form-control').textcomplete([{
words: ['тоҷик', 'ҷаҳон', 'english'],
match: /(^|[^\wа-яёҷ])([\wа-яё]{2,})$/i,
search: function(term, callback) {
callback($.map(this.words, function(word) {
return word.indexOf(term) === 0 ? word : null;
}));
},
index: 2,
replace: function(word) {
return '$1' + word + ' ';
}
}]);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.textcomplete/1.8.4/jquery.textcomplete.min.js"></script>
<textarea class="form-control"></textarea>
Here the words 'тоҷик'
and 'english'
are working but 'ҷаҳон'
is not. How can I fix this?
I need the following letters to work: ғ,ӯ,қ,ҳ,ҷ,ӣ
and а-я
.
Similar question was already answered.
$('#textcomplete').textcomplete([{
words: ['тоҷик', 'ҷаҳон', 'english'],
match: /(^|\S*)([^\u0000-\u007f]{2,}|\w{2,})$/,
search: function(term, callback) {
callback($.map(this.words, function(word) {
return word.indexOf(term) === 0 ? word : null;
}));
},
index: 2,
replace: function(word) {
return word + ' ';
}
}]);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.textcomplete/1.8.4/jquery.textcomplete.min.js"></script>
<textarea id="textcomplete"></textarea>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With