selection


Rangy expands for cyrillic


I'm using Rangy plugin and textRange module and there is a problem. Then I'm using selection.expand('word') on the such text "расстояние {москва} геленджика" (selected text in brackets) Rangy expands it to the adjacent words and I got such selected texts "{расстояние москва геленджика}". But in this case I already have a selected word! I just need expanding to {москва} in м{оск}ва situations.
How can I solve this? What is the difference between different languages, that causing this problem?
I answered this on the Rangy forum. In case that link stops working, here's what I wrote:
It's set up for Latin script by default, but you can specify a regular expression in the expand() method. The default is /[a-z0-9]+('[a-z0-9]+)*/gi, which is pretty basic but provided as a reasonable default for English.
A simple example:
sel.expand("word", {
wordOptions: {
wordRegex: /[a-z0-9\u0400-\u04FF]+('[a-z0-9\u0400-\u04FF]+)*/gi
}
});
I'm no expert in Cyrillic so I've just added some Cyrillic characters to the character classes in the regular expression for illustration purposes. You could do better using XRegExp and its Unicode plugin:
sel.expand("word", {
wordOptions: {
wordRegex: XRegExp("[\\p{L}\\d]+('[\\p{L}\\d]+)*", "gi")
}
});

Related Links

Big Query - And/Or Operators
Selecting text including $ in Sublime Text 3
polymer core-animated-pages switching on tap
Genetic Algorithm new generation exponentially increasing
Kendo IntegerTextBoxFor select all numbers on focus
Arcpy - Selecting Attribute and adding attributes to a feature class
Selecting multitple, specific lines in Sublime Text using the keyboard
Genetic Programming : Difference between Roulette Rank and Tournament Selection
Unselect all sections when “Custom” InstType is chosen
Drawing transform independent layout bounds in JavaFX
How to perform rank based selection in a genetic algorithm?
Copy-paste of selections with Xlib in X11: XA_TARGETS array of atoms
Selecting who should breed with whom from a list of qualified parents?
programmatically change selected rows in a slickgrid
dgrid selection- select row only when I click on check box
Getting the Root-Element of an EObject which is being listened in a Tree-/Tableviewer

Categories

HOME
tomcat
mpdf
schema.org
long-integer
dafny
filesize
google-webmaster-tools
gentelella
repair
javafx-8
angular2-template
pyresttest
kurento
polymer-2.x
hspi
msmq
elastic-load-balancer
yahoo
game-maker
vimeo
max-msp-jitter
exe
office-ui-fabric
spyder
data-type-conversion
workday
ava
eclipse-emf
cell
dragula
unordered-multimap
beego
list-comprehension
jackrabbit-oak
premake
python-2.x
rspec-rails
devtools
bootstrap-sass
spring-rabbitmq
cordys-opentext
django-crispy-forms
uivisualeffectview
selenide
export-to-pdf
right-click
yoast
dbcc
react-intl
liteide
sonarqube5.2
icecast
ilrepack
gnome-terminal
glassfish-4.1
glimpse
gawk
gapi
mifos
ipywidgets
pjax
nclam
livereload
bilinear-interpolation
gridbaglayout
gwt-syncproxy
openmrs
wikimedia-commons
teensy
godeps
juniper-network-connect
variable-length-array
html.actionlink
sqlbase
css-paged-media
supersocket.net
artisan
componentart
kognitio-wx2
comctl32
configurable-product
datagridcomboboxcolumn
flurry-analytics
visual-c++-2012
box2dweb
csslint
rails-api
pageviews
webaii
pre
principalcontext
particle-swarm
virtual-channel
chartfx
android-authenticator
oembed
examine
cgrectmake
instance-variables
clearinterval
popup-blocker
fitch-proofs
exponent
yuidoc
sigar
page-curl
kohana-auth
ccnet-config
jquery-effects
ntruencrypt
tso
bindable-linq

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App