Skip to content

Instantly share code, notes, and snippets.

@eimg
Last active May 5, 2022 08:30
Show Gist options
  • Save eimg/3ca350f937228a2c7187ca920dcddf4b to your computer and use it in GitHub Desktop.
Save eimg/3ca350f937228a2c7187ca920dcddf4b to your computer and use it in GitHub Desktop.
A regular expression example to us in counting Burmese syllabus in a string.
// RegEx to count syllabus a string
// with Burmese content
"မန္တလေးမြို့မှ XYZ စတိုး (၂) ကို ဒီလမ်းအတိုင်း ဖြောင့်ဖြောင့် သွားပါ".match(
/([က-ဪ](?!်|္|့်)|[ဿ-၏]|[!-~]|\s)/g
).length;
// => 29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment