Last active
February 10, 2018 13:04
-
-
Save uroybd/ccda2bdb07ad38085cd406724b8229f8 to your computer and use it in GitHub Desktop.
Javascript Regex to get 'Units' from Bengali text. (Useful for text transforming bengali with JS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bengaliUnitRegex = /([অ-হড়-য়](্[অ-হড়-য়])+|[অ-হড়-য়]্|[অ-হড়-য়])[া-ৌ]*[ঁঃং]*|ৎ|[০-৯]| /g; | |
// You can match with str.mathc(rg) and it will yield units as array. Example: | |
var testText = "আদর্শলিপি"; | |
testText.match(bengaliUnitRegex); | |
// > ["আ", "দ", "র্শ", "লি", "পি"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment