What is the right regex to make sure an answer is exclusively Japanese Kana?
- User
What is the right regex to make sure an answer is exclusively Japanese Kana?
- Assistant
You can use the following regular expression pattern to ensure that an answer consists exclusively of Japanese Kana characters:
^[\p{Script=Hiragana}\p{Script=Katakana}ー-]+$
Explanation:
-
^ - Matches the start of the string.
-
[\p{Script=Hiragana}\p{Script=Katakana}ー-] - Character class that allows matching of either Hiragana characters, Katakana characters, or the long vowel mark (ー) and its half-width counterpart (-).
-
"+ -" Allows one or more occurrences of the character class.
-
$ - Matches the end of the string.
This regular expression pattern will only match strings that consist entirely of Hiragana characters, Katakana characters, or the long vowel mark. It will exclude any other characters such as Kanji, numbers, or Latin characters.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →