Regex for aliases of pages in other languages

Use case or problem

Some languages have multiple word forms, which makes it harder to add aliases to notes.
Take russian for example: a simple word for cat − “кот/кошка” may have multiple forms for different genders, single-plural, and different grammatical cases.

To be able to use that word as alias for backlinks, one would need to add all possible wordforms to the aliases in YAML.

---
aliases: [ кот, кота, коту, котом, коте, коты, котов, котам, котов, котами, кошка, кошки, кошке, кошку, кошкой, кошки, кошек, кошкам, кошек, кошками, кошках ]
---

For word pairs, like “карта города” it becomes even more tedious, since both words’ forms must be taken into account.

Proposed solution

I believe, the easiest to implement solution is to allow regular expressions inside aliases key.

---
aliases: [ "ко[тш][а-я]*", SomeOtherAlias ]
---

Current workaround (optional)

Either using english-only words, or using sites/scripts to generate all possible word forms.

Related feature requests

Similar ideas have already been suggested, like using fuzzy search, or adding compatibility for zettelkasten names.
Regex should solve these problems easily.

5 Likes

That would be a really cool feature!

I haven’t thought about it before, but a workaround may be following:

  1. Use basic template for notes and other specific templates that add metadata
  2. Fill in the aliases using regexmatch() function
  3. Use the following dataview query(or its modification)
LIST
WHERE regexmatch(this.aliases, file.name)

It works!