1

I have a simple regex search which matches [A-Za-z], however I would like it to match other characters which would be used in dictionary words for non-english languages. e.g. ü, Ø, ɵ 人参, while excluding:

  • White space.
  • Punctuation.
  • Numbers.
  • Other non-language symbols arrows, characters for drawing diagrams ... etc.

How can Emacs regex match against unicode words used in language?

I tried [:word:] but this matches numbers.

1
  • Thanks, thats it (can be made into answer?)
    – ideasman42
    Commented Apr 3, 2020 at 4:02

1 Answer 1

1

Use the character class [:alpha:]

E.g. [[:alpha:]]+ to match one-or-more such characters.

C-hig (elisp)Char Classes says:

[:alpha:]

This matches any letter. For multibyte characters, it matches characters whose Unicode general-category property (*note Character Properties::) indicates they are alphabetic characters.

Whereas you were using:

[:word:]

This matches any character that has word syntax (*note Syntax Class Table::).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.