python – Regex \b – Devanagiri
I have a regex in Python which uses \b to split words. When I use it on Devanagiri text, I notice that not all characters in the Unicode block are defined as word characters. Certain punctuation marks appear to be defined as non-word characters. This is fundamentally wrong as words in this script can end with these characters.
Is it possible to tell regex to treat the entire block from 0x900 to 0x97f as word characters?
See for example the following regex.
'(?
Here, the first four words abc, ade, zip and चाय are detected at proper word boundaries. The word पानी however, ends with a vowel ी and regex does not treat it as a valid word boundary when ideally it should be.
>>> import re
>>> re.findall(r"(?
Can I change this regex behavior and if yes, how?
Read more here: Source link
