Unicode Pattern

In a blueprint, I use a pattern to allow entries like these:

2021
2021–2024
2021–present
2021/2025

pattern: "^[0-9]{4}(–([0-9]{4}|[a-zA-ZäöüßÄÖÜ ]+))?$"

Currently, my pattern allows English and German characters only. I want it to allow all Unicode characters such as French et al. How can I achieve this?

I wonder if pattern: or match: works better? What do you recommend to use for a text field?

pattern: "/\b\d{4}(?:\/\d{4}|–\p{L}+|–\d{4})?\b/u" or

validate:
  match: "/\b\d{4}(?:\/\d{4}|–\p{L}+|–\d{4})?\b/u"

I receive error messages on both. How does Kirby work with REGEX? What is the best practice?

This pattern: "\b\d{4}(?:\/\d{4}|–[^\d\/]+|–\d{4})?\b" works almost perfectly but some inputs are still questionable. I cannot write 1234–Äaa á for instance but 1234–Äaa a.

Syntax is either:

text1:
  type: text
  width: 1/2
  pattern: '[0-9]'

or:

text2:
  type: text
  width: 1/2
  validate:
    match: '/[0-9]/'
1 Like