NAME Regexp::CharClasses::Thai - useful character properties for Thai regular expressions (regex) SYNOPSIS use Regexp::CharClasses::Thai; $c = "..."; # some UTF8 string $c =~ /\p{InThaiCons}/; # match only Thai consonants $c =~ /\p{InThaiTone}/; # match only Thai tone marks - OR - $c =~ /\p{IsThaiCons}/; # match only Thai consonants $c =~ /\p{IsThaiTone}/; # match only Thai tone marks # see description for full set of terms DESCRIPTION This module supplements the UTF-8 character-class definitions available to regular expressions (regex) with special groups relevant to Thai linguistics. The following classes are defined: โมดูลนี้เป็นส่วนเสริมคำจำà¸à¸±à¸”ความคลาสà¸à¸±à¸à¸‚ระ UTF-8 ใช้ได้à¸à¸±à¸š (regex) ทั่วไป ด้วยà¸à¸¥à¸¸à¹ˆà¸¡à¸žà¸´à¹€à¸¨à¸© ที่เà¸à¸µà¹ˆà¸¢à¸§à¸‚้à¸à¸‡à¸à¸±à¸šà¸ าษาไทย มีà¸à¸²à¸£à¸à¸³à¸«à¸™à¸”คลาสต่à¸à¹„ปนี้: InThai / IsThai Matches ALL characters in the Thai unicode code-point range. จับคู่à¸à¸±à¸à¸‚ระทั้งหมดในช่วงจุดโค้ดยูนิโค้ดภาษาไทย InThaiCons / IsThaiCons Matches Thai consonant letters, leaving out vowels (but including those vowels which are sometimes consonants). จับคู่พยัà¸à¸Šà¸™à¸°à¹„ทย (รวมสระที่บางครั้งเป็นพยัà¸à¸Šà¸™à¸°à¸”้วย) InThaiVowel / IsThaiVowel Matches Thai vowels only, including compounded and free-standing vowels. Exceptions here include several of the “consonants†which also serve as vowels: o-ang, yo-yak, double ro-rua, lu and ru, and wo-waen (à¸, ย, รร, ฦ, ฤ, ว), which are also included except for the two-character รร. NOTE: Thai vowels cannot stand alone: they are always connected with a consonant. Many of these, without their consonant companions, will appear with the unicode dotted-circle character (U+25CC) when rendered, showing a character is missing. Conversely, Thai consonants can exist without a vowel, and some Thai words do not have written vowels (the vowel is implied). จับคู่สระไทยเท่านั้น รวมทั้งสระประà¸à¸à¸š à¹à¸¥à¸°à¸ªà¸£à¸°à¸à¸´à¸ªà¸£à¸° ข้à¸à¸¢à¸à¹€à¸§à¹‰à¸™ ในที่นี้รวมถึง “พยัà¸à¸Šà¸™à¸°â€ หลายตัวซึ่งทำหน้าที่เป็นสระด้วย เช่น (à¸, ย, รร, ฦ, ฤ, ว) ซึ่งรวมà¸à¸¢à¸¹à¹ˆà¸”้วยยà¸à¹€à¸§à¹‰à¸™à¸à¸±à¸à¸‚ระสà¸à¸‡à¸•à¸±à¸§ รร InThaiAlpha / IsThaiAlpha Matches only the Thai alphabetic characters (consonants & vowels), excluding all digits, tone marks, and punctuation marks. จับคู่เฉพาะตัวà¸à¸±à¸à¸©à¸£à¹„ทย (พยัà¸à¸Šà¸™à¸°à¹à¸¥à¸°à¸ªà¸£à¸°) ไม่รวมตัวเลข เครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸“ยุà¸à¸•à¹Œ à¹à¸¥à¸°à¹€à¸„รื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸„ตà¸à¸™à¸—ั้งหมด InThaiWord / IsThaiWord Matches all Thai characters used to form words, including: consonants, vowels, and tone marks; but excluding all digits and punctuation marks. จับคู่ตัวà¸à¸±à¸à¸©à¸£à¹„ทยทั้งหมดที่ใช้สร้างคำ รวมทั้ง พยัà¸à¸Šà¸™à¸° สระ à¹à¸¥à¸°à¹€à¸„รื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸“ยุà¸à¸•à¹Œ à¹à¸•à¹ˆà¹„ม่รวมตัวเลขทั้งหมด à¹à¸¥à¸°à¹€à¸„รื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸„ตà¸à¸™ InThaiTone / IsThaiTone Matches only the Thai tone marks, leaving out all letters, digits and punctuation marks. จับคู่เฉพาะเครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸“ยุà¸à¸•à¹Œà¹„ทยโดยไม่รวม ตัวà¸à¸±à¸à¸©à¸£ ตัวเลข หรืภเครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸„ตà¸à¸™ ทั้งหมด InThaiMute / IsThaiMute The single character U+0E4C (Thai Thanthakhat/Garan), as it seems neither typical of a tone mark, nor a punctuation mark. It comes nearer to usage as a tone mark, but instead of affecting the tone of a vowel, it silences one or more consonants. à¸à¸±à¸à¸©à¸£à¸•à¸±à¸§à¹€à¸”ียว ธัณฑฆาต/à¸à¸²à¸£à¸±à¸™à¸•à¹Œ InThaiPunct / IsThaiPunct Matches Thai punctuation characters, not including tone marks, white space, digits or alphabetic characters, and not including non-Thai punctuation marks (such as English [.,'"!?] etc.). จับคู่à¸à¸±à¸à¸‚ระเครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸„ตà¸à¸™à¸ าษาไทย ไม่รวมเครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸“ยุà¸à¸•à¹Œ ช่à¸à¸‡à¸§à¹ˆà¸²à¸‡ ตัวเลข หรืภตัวà¸à¸±à¸à¸©à¸£ à¹à¸¥à¸°à¹„ม่รวม เครื่à¸à¸‡à¸«à¸¡à¸²à¸¢à¸§à¸£à¸£à¸„ตà¸à¸™ ที่ไม่ใช่ภาษาไทย (เช่น à¸à¸±à¸‡à¸à¸¤à¸© [.,'"!?] เป็นต้น) InThaiCompVowel / IsThaiCompVowel Matches only the Thai vowels which are compounded with a Thai consonant, and matching only the vowel portion of the compounded character: ◌ั ◌ิ ◌ี ◌ึ ◌ื ◌ุ ◌ู ◌็ ◌๠จับคู่เฉพาะสระไทยที่ประà¸à¸à¸šà¸à¸±à¸šà¸žà¸¢à¸±à¸à¸Šà¸™à¸°à¹„ทยเท่านั้น à¹à¸¥à¸°à¸ˆà¸±à¸šà¸„ู่เฉพาะส่วนสระขà¸à¸‡à¸•à¸±à¸§à¸à¸±à¸à¸©à¸£à¸™à¸±à¹‰à¸™à¸—ี่ประสมเท่านั้น นั่นคืà¸: ◌ั ◌ิ ◌ี ◌ึ ◌ื ◌ุ ◌ู ◌็ ◌๠InThaiPreVowel / IsThaiPreVowel Matches only the subset of vowels which appear before the consonant with which they are associated (though in Thai they are sounded after said consonant); this excludes all consonant-vowels and does not include any of the compounded vowels. จับคู่เฉพาะชุดย่à¸à¸¢à¸‚à¸à¸‡à¸ªà¸£à¸°à¸—ี่ปราà¸à¸ à¸à¹ˆà¸à¸™ พยัà¸à¸Šà¸™à¸°à¸—ี่เà¸à¸µà¹ˆà¸¢à¸§à¸‚้à¸à¸‡ (à¹à¸•à¹ˆà¹€à¸›à¹‡à¸™à¸ าษาไทยถูà¸à¸Ÿà¸±à¸‡ หลัง พยัà¸à¸Šà¸™à¸°à¸”ังà¸à¸¥à¹ˆà¸²à¸§); นี่ไม่รวมทั้งหมด พยัà¸à¸Šà¸™à¸°-สระ à¹à¸¥à¸°à¹„ม่รวมถึงสระประสมใดๆ InThaiPostVowel / IsThaiPostVowel Matches only the vowels which appear after the consonant with which they are associated; this excludes all consonant-vowels and does not include any of the compounded vowels. จับคู่เฉพาะสระนั้นที่ปราà¸à¸ หลัง พยัà¸à¸Šà¸™à¸° ที่เà¸à¸µà¹ˆà¸¢à¸§à¸‚้à¸à¸‡ ไม่รวมพยัà¸à¸Šà¸™à¸°-สระทั้งหมด à¹à¸¥à¸° ไม่รวมถึงสระประสมใดๆ InThaiHCons / IsThaiHCons Matches Thai high-class consonants: ข ฃ ฉ ภถ ผ ภศ ษ ส ห. จับคู่พยัà¸à¸Šà¸™à¸°à¹„ทยชั้นสูง: ข ฃ ฉ ภถ ผ ภศ ษ ส ห. InThaiMCons / IsThaiMCons Matches Thai middle-class consonants: ภจ ฎ ภด ต บ ป à¸. จับคู่พยัà¸à¸Šà¸™à¸°à¹„ทยชนชั้นà¸à¸¥à¸²à¸‡: ภจ ฎ ภด ต บ ป à¸. InThaiLCons / IsThaiLCons Matches Thai low-class consonants: จับคู่พยัà¸à¸Šà¸™à¸°à¹„ทยชั้นต่ำ: ค ฅ ฆ ง ช ซ ฌ ภฑ ฒ ณ ท ธ น พ ฟ ภม ย ร ฤ ล ฦ ว ฬ ฮ. InThaiFinCons / IsThaiFinCons Matches Thai consonants which can occur as the final consonant of a syllable. This excludes ฉ, ซ, ผ, à¸, ห, ฮ, which never appear at the end of a Thai syllable, as well as ย, ว, à¸, which only appear at the end of a syllable when used as a vowel. NOTE: Any Thai consonant can be an initial consonant, so there is no separate designation for these: just use 'InThaiCons' or 'IsThaiCons'. จับคู่พยัà¸à¸Šà¸™à¸°à¹„ทยซึ่งà¸à¸²à¸ˆà¹€à¸›à¹‡à¸™à¸žà¸¢à¸±à¸à¸Šà¸™à¸°à¸•à¸±à¸§à¸ªà¸¸à¸”ท้ายขà¸à¸‡à¸žà¸¢à¸²à¸‡à¸„์ได้ ทั้งนี้ ไม่รวมถึง ฉ ซ ผ ภห ห ฮ ซึ่งไม่เคยปราà¸à¸à¸•à¹ˆà¸à¸—้ายพยางค์ไทย à¹à¸¥à¸° ไม่รวมถึง ย ว ภซึ่งปราà¸à¸à¸—ี่ท้ายพยางค์เมื่à¸à¹ƒà¸Šà¹‰à¹€à¸›à¹‡à¸™à¸ªà¸£à¸°à¹€à¸—่านั้น หมายเหตุ: พยัà¸à¸Šà¸™à¸°à¹„ทยใดๆ à¸à¹‡à¸ªà¸²à¸¡à¸²à¸£à¸–เป็นพยัà¸à¸Šà¸™à¸°à¹€à¸£à¸´à¹ˆà¸¡à¸•à¹‰à¸™à¹„ด้ ดังนั้นจึงไม่มีà¸à¸²à¸£à¸à¸³à¸«à¸™à¸”à¹à¸¢à¸à¸ªà¸³à¸«à¸£à¸±à¸šà¸žà¸¢à¸±à¸à¸Šà¸™à¸°à¹€à¸«à¸¥à¹ˆà¸²à¸™à¸µà¹‰: เพียงใช้ 'InThaiCons' หรืภ'IsThaiCons' InThaiDualCons / IsThaiDualCons Matches Thai consonants which are often paired as the primary “consonant†of the syllable (the leading ones), around which a single vowel or vowel combination will be centered. Many combinations of consonants, unassociated by a single vowel, may occur in Thai: this does not address them. For example: the “hm†in “hma†(dog) function together as if they were a single consonant--the high-class “h†giving its tone to the “mâ€. This attempts to address these common consonant pairs. IT MAY NOT BE EXHAUSTIVE. Pairs considered: à¸à¸§ à¸à¸¥ à¸à¸£ ขร ขล ขว คร คล คว ตร ปร ปล บร บล ดร ผล พร พล ทร สร จร ซร [and the sonorant consonants] หม หน หล หย หง หว หภà¸à¸¢ จับคู่พยัà¸à¸Šà¸™à¸°à¹„ทยซึ่งมัà¸à¸ˆà¸±à¸šà¸„ู่เป็น “พยัà¸à¸Šà¸™à¸°â€ หลัà¸à¸‚à¸à¸‡à¸žà¸¢à¸²à¸‡à¸„์ (ตัวนำ) โดยจะเน้นà¸à¸²à¸£à¹ƒà¸Šà¹‰à¸ªà¸£à¸°à¹€à¸”ี่ยวหรืà¸à¸ªà¸£à¸°à¸£à¸§à¸¡à¸à¸±à¸™ พยัà¸à¸Šà¸™à¸°à¸«à¸¥à¸²à¸¢à¸•à¸±à¸§à¸—ี่ไม่เà¸à¸µà¹ˆà¸¢à¸§à¸‚้à¸à¸‡à¸à¸±à¸™à¸”้วยสระตัวเดียวà¸à¸²à¸ˆà¹€à¸à¸´à¸”ขึ้นในภาษาไทย à¹à¸•à¹ˆà¹„ม่ได้à¸à¸¥à¹ˆà¸²à¸§à¸–ึง ตัวนั้น เช่น: “หม†ใน “หมา†ทำงานร่วมà¸à¸±à¸™à¸£à¸²à¸§à¸à¸±à¸šà¸§à¹ˆà¸² เป็นพยัà¸à¸Šà¸™à¸°à¸•à¸±à¸§à¹€à¸”ียว - “ห†ระดับสูงที่ให้เสียงขà¸à¸‡ “ม†นี่เป็นà¸à¸²à¸£à¸žà¸¢à¸²à¸¢à¸²à¸¡à¸žà¸¹à¸”ถึงคู่พยัà¸à¸Šà¸™à¸°à¸—ั่วไปเหล่านี้ มันà¸à¸²à¸ˆà¸ˆà¸°à¹„ม่ละเà¸à¸µà¸¢à¸”ถี่ถ้วน InThaiDualC1 / IsThaiDualC1 Matches the initial consonant of a dual-consonant as described above: ภข ค จ ซ ด ต ท บ ป ผ พ ส ห à¸. จับคู่พยัà¸à¸Šà¸™à¸°à¹€à¸£à¸´à¹ˆà¸¡à¸•à¹‰à¸™à¸‚à¸à¸‡à¸žà¸¢à¸±à¸à¸Šà¸™à¸°à¸„ู่ตามที่à¸à¸˜à¸´à¸šà¸²à¸¢à¹„ว้ข้างบน: ภข ค จ ซ ด ต ท บ ป ผ พ ส ห à¸. InThaiDualC2 / IsThaiDualC2 Matches the second consonant of a dual-consonant as described above: ง ภน ม ย ร ล ว. จับคู่พยัà¸à¸Šà¸™à¸°à¸•à¸±à¸§à¸—ี่สà¸à¸‡à¸‚à¸à¸‡à¸žà¸¢à¸±à¸à¸Šà¸™à¸°à¸„ู่ตามที่à¸à¸˜à¸´à¸šà¸²à¸¢à¹„ว้ข้างต้น: ง ภน ม ย ร ล ว. InThaiConsVowel / IsThaiConsVowel Matches Thai characters which can function as either consonants or vowels: ย ร ฤ ฦ ว à¸. จับคู่ตัวà¸à¸±à¸à¸©à¸£à¹„ทยซึ่งทำหน้าที่เป็นพยัà¸à¸Šà¸™à¸°à¸«à¸£à¸·à¸à¸ªà¸£à¸°à¹„ด้: ย ร ฤ ฦ ว à¸. Note: Thais consider 0E33 (◌ำ) to be only a vowel, and it can never function as only a consonant (it must always have a vowel component), so it is NOT included here: but it is actually a vowel-consonant combination, phonetically, finishing with the “m†sound. This class addresses only Thai characters which can be either consonant or vowel, but not both at the same time. Additionally, 0E23 (ร) is a consonant which, when doubled (รร), functions as a vowel. (In actual fact, it functions as a vowel-consonant combination as well, with the final consonant sound varying based on its usage context.) Though it can never be a vowel if it occurs singly, these properties cannot be defined to span two consecutive characters, so it IS included here. หมายเหตุ: คนไทยถืà¸à¸§à¹ˆà¸² 0E33 (◌ำ) เป็นเพียงสระเท่านั้น à¹à¸¥à¸°à¹„ม่สามารถ ทำหน้าที่เป็นเพียงพยัà¸à¸Šà¸™à¸°à¹„ด้ (จะต้à¸à¸‡à¸¡à¸µà¸ªà¹ˆà¸§à¸™à¸›à¸£à¸°à¸à¸à¸šà¸‚à¸à¸‡à¸ªà¸£à¸°à¹€à¸ªà¸¡à¸) จึงไม่รวมไว้ที่นี่ à¹à¸•à¹ˆà¸ˆà¸£à¸´à¸‡à¹† à¹à¸¥à¹‰à¸§à¹€à¸›à¹‡à¸™à¸ªà¸£à¸°à¸œà¸ªà¸¡à¸žà¸¢à¸±à¸à¸Šà¸™à¸° ตามสัทศาสตร์ ลงท้ายด้วยเสียง “ม†à¸à¸¥à¸¸à¹ˆà¸¡à¸™à¸µà¹‰à¸µà¹‰à¹€à¸™à¹‰à¸™à¹€à¸‰à¸žà¸²à¸°à¸•à¸±à¸§à¸à¸±à¸à¸©à¸£à¹„ทย ที่เป็นพยัà¸à¸Šà¸™à¸°à¸«à¸£à¸·à¸à¸ªà¸£à¸°à¸à¹‡à¹„ด้ à¹à¸•à¹ˆà¹„ม่ใช่ทั้งสà¸à¸‡à¸•à¸±à¸§à¸žà¸£à¹‰à¸à¸¡à¸à¸±à¸™ นà¸à¸à¸ˆà¸²à¸à¸™à¸µà¹‰ 0E23 (ร) ยังเป็นพยัà¸à¸Šà¸™à¸°à¸‹à¸¶à¹ˆà¸‡à¹€à¸¡à¸·à¹ˆà¸à¹€à¸•à¸´à¸¡ (รร) สà¸à¸‡à¸•à¸±à¸§à¹à¸¥à¹‰à¸§ จะทำหน้าที่เป็นสระ (ในความเป็นจริง มันทำหน้าที่เป็นเสียงสระ ผสมพยัà¸à¸Šà¸™à¸°à¸”้วย โดยเสียงพยัà¸à¸Šà¸™à¸°à¸•à¸±à¸§à¸ªà¸¸à¸”ท้ายจะà¹à¸•à¸à¸•à¹ˆà¸²à¸‡à¸à¸±à¸™à¹„ปตามบริบท à¸à¸²à¸£à¹ƒà¸Šà¹‰à¸‡à¸²à¸™) à¹à¸¡à¹‰à¸§à¹ˆà¸²à¸ˆà¸°à¹€à¸›à¹‡à¸™à¸ªà¸£à¸°à¹€à¸”ี่ยวไม่ได้หาà¸à¹€à¸à¸´à¸”ขึ้นเพียงตัวเดียว à¹à¸•à¹ˆà¸„ุณสมบัติเหล่านี้ไม่สามารถà¸à¸³à¸«à¸™à¸”ให้ขยายสà¸à¸‡à¸Šà¹ˆà¸§à¸‡à¸•à¸´à¸”ต่à¸à¸à¸±à¸™à¹„ด้ ตัวà¸à¸±à¸à¸©à¸£ จึงรวมไว้ที่นี่ InThaiDigit / IsThaiDigit Matches Thai numerical digits only: ๠๑ ๒ ๓ ๔ ๕ ๖ ๗ ๘ ๙. จับคู่ตัวเลขไทยเท่านั้น: ๠๑ ๒ ๓ ๔ ๕ ๖ ๗ ๘ ๙. InThaiCurrency / IsThaiCurrency Matches the Thai baht currency character: ฿. จับคู่à¸à¸±à¸à¸‚ระสà¸à¸¸à¸¥à¹€à¸‡à¸´à¸™à¸šà¸²à¸—ไทย: ฿. EXPORTS Exports 'classes' by default. PROPERTIES The following properties are exported from Regexp::CharClasses::Thai: :classes InThai InThaiAlpha InThaiWord InThaiCons InThaiHCons InThaiMCons InThaiLCons InThaiVowel InThaiPreVowel InThaiPostVowel InThaiCompVowel InThaiDigit InThaiTone InThaiMute InThaiPunct InThaiCurrency InThaiFinCons InThaiDualCons InThaiDualC1 InThaiDualC2 InThaiConsVowel IsThai IsThaiAlpha IsThaiWord IsThaiCons IsThaiHCons IsThaiMCons IsThaiLCons IsThaiVowel IsThaiPreVowel IsThaiPostVowel IsThaiCompVowel IsThaiDigit IsThaiTone IsThaiMute IsThaiPunct IsThaiCurrency IsThaiFinCons IsThaiDualCons IsThaiDualC1 IsThaiDualC2 IsThaiConsVowel :characters InKokai InKhokhai InKhokhuat InKhokhwai InKhokhon InKhorakhang InNgongu InChochan InChoching InChochang InSoso InShochoe InYoying InDochada InTopatak InThothan InThonangmontho InThophuthao InNonen InDodek InTotao InThothung InThothahan InThothong InNonu InBobaimai InPopla InPhophung InFofa InPhophan InFofan InPhosamphao InMoma InYoyak InRorua InRu InLoling InLu InWowaen InSosala InSorusi InSosua InHohip InLochula InOang InHonokhuk InPaiyannoi InSaraa InMaihanakat InSaraaa InSaraam InSarai InSaraii InSaraue InSarauee InSarau InSarauu InPhinthu InBaht InSarae InSaraae InSarao InSaraaimaimuan InSaraaimaimalai InLakkhangyao InMaiyamok InMaitaikhu InMaiek InMaitho InMaitri InMaichattawa InThanthakhat InGaran InNikhahit InYamakkan InFongman InThZero InThOne InThTwo InThThree InThFour InThFive InThSix InThSeven InThEight InThNine InAngkhankhu InKhomut IsKokai IsKhokhai IsKhokhuat IsKhokhwai IsKhokhon IsKhorakhang IsNgongu IsChochan IsChoching IsChochang IsSoso IsShochoe IsYoying IsDochada IsTopatak IsThothan IsThonangmontho IsThophuthao IsNonen IsDodek IsTotao IsThothung IsThothahan IsThothong IsNonu IsBobaimai IsPopla IsPhophung IsFofa IsPhophan IsFofan IsPhosamphao IsMoma IsYoyak IsRorua IsRu IsLoling IsLu IsWowaen IsSosala IsSorusi IsSosua IsHohip IsLochula IsOang IsHonokhuk IsPaiyannoi IsSaraa IsMaihanakat IsSaraaa IsSaraam IsSarai IsSaraii IsSaraue IsSarauee IsSarau IsSarauu IsPhinthu IsBaht IsSarae IsSaraae IsSarao IsSaraaimaimuan IsSaraaimaimalai IsLakkhangyao IsMaiyamok IsMaitaikhu IsMaiek IsMaitho IsMaitri IsMaichattawa IsThanthakhat IsGaran IsNikhahit IsYamakkan IsFongman IsThZero IsThOne IsThTwo IsThThree IsThFour IsThFive IsThSix IsThSeven IsThEight IsThNine IsAngkhankhu IsKhomut EXAMPLES use Regexp::CharClasses::Thai qw( :all ); 'à¸' =~ /\p{InThai}/; # Match 'à¸' =~ /\p{InThaiAlpha}/; # Match 'à¸' =~ /\p{InThaiCons}/; # Match 'à¸' =~ /\p{InThaiHCons}/; # No match 'à¸' =~ /\p{InThaiMCons}/; # Match 'à¸' =~ /\p{InThaiLCons}/; # No match 'à¸' =~ /\p{InThaiDigit}/; # No match 'à¸' =~ /\p{InThaiTone}/; # No match 'à¸' =~ /\p{InThaiVowel}/; # No match 'à¸' =~ /\p{InThaiCompVowel}/; # No match 'à¸' =~ /\p{InThaiPreVowel}/; # No match 'à¸' =~ /\p{InThaiPostVowel}/; # No match 'à¸' =~ /\p{InThaiPunct}/; # No match 'à¸' =~ /\p{IsKokai}/; # Match 'ไ' =~ /\p{InThai}/; # Match 'ไ' =~ /\p{InThaiAlpha}/; # Match 'ไ' =~ /\p{InThaiCons}/; # No match 'ไ' =~ /\p{InThaiHCons}/; # No match 'ไ' =~ /\p{InThaiMCons}/; # No match 'ไ' =~ /\p{InThaiLCons}/; # No match 'ไ' =~ /\p{InThaiDigit}/; # No match 'ไ' =~ /\p{InThaiTone}/; # No match 'ไ' =~ /\p{InThaiVowel}/; # Match 'ไ' =~ /\p{InThaiCompVowel}/; # No match 'ไ' =~ /\p{InThaiPreVowel}/; # Match 'ไ' =~ /\p{InThaiPostVowel}/; # No match 'ไ' =~ /\p{InThaiPunct}/; # No match 'ไ' =~ /\p{IsSaraaimaimalai}/; # Match MORE COMPLEX USAGE EXAMPLE my $phrase = 'ข่าวนี้ได้à¹à¸žà¸£à¹ˆà¸ªà¸°à¸žà¸±à¸”à¸à¸à¸à¹„ปà¸à¸¢à¹ˆà¸²à¸‡à¸£à¸§à¸”เร็ว'; print "A phrase with multiple syllables: $phrase\n"; my $prevowel_syllables = $phrase =~ s/ ( (?:\p{InThaiPreVowel}) (?: (?:\p{InThaiDualC1}\p{InThaiDualC2}) | (?:\p{InThaiCons}){1} ) (?:[\p{InThaiTone}\p{InThaiCompVowel}\p{InThaiPostVowel}]){0,3} (?: (?:[\p{InThaiFinCons}\p{IsYoyak}\p{IsWowaen}]){0,5} (?!\p{InThaiPostVowel}) )* (?:\p{InThaiMute})? ) /($1)/gx; print "Syllables with pre-vowels marked: $phrase\n"; print "Number of these marked syllables: $prevowel_syllables\n"; UNICODE All of the character codepoints in this module are based on the official unicode designations for Thai as found in this chart: จุดโค้ดà¸à¸±à¸à¸‚ระทั้งหมดในโมดูลนี้à¸à¸´à¸‡à¸•à¸²à¸¡à¸à¸²à¸£à¸à¸³à¸«à¸™à¸”ยูนิโค้ดà¸à¸¢à¹ˆà¸²à¸‡ เป็นทางà¸à¸²à¸£à¸ªà¸³à¸«à¸£à¸±à¸šà¸ าษาไทยดังที่พบในà¹à¸œà¸™à¸ ูมินี้: http://www.unicode.org/charts/PDF/U0E00.pdf The spellings of these latinized/transliterated character names as used in the property definitions for each character come directly from this unicode chart, sans spaces, and with only their first letter in uppercase. The “Garan†(a common name) is added as an alias for its official name, Thanthakhat (of uncommon usage). à¸à¸²à¸£à¸ªà¸°à¸à¸”ขà¸à¸‡à¸Šà¸·à¹ˆà¸à¸à¸±à¸à¸‚ระà¹à¸šà¸šà¸¥à¸²à¸•à¸´à¸™/ทับศัพท์ที่ใช้ในคำจำà¸à¸±à¸”ความขà¸à¸‡ คุณสมบัติสำหรับà¸à¸±à¸à¸‚ระà¹à¸•à¹ˆà¸¥à¸°à¸•à¸±à¸§à¸™à¸±à¹‰à¸™à¸¡à¸²à¸ˆà¸²à¸à¹à¸œà¸™à¸ ูมิยูนิโค้ดนี้ à¸à¸²à¸£à¹€à¸§à¹‰à¸™à¸§à¸£à¸£à¸„à¹à¸šà¸šà¹„ม่มี à¹à¸¥à¸°à¸¡à¸µà¹€à¸žà¸µà¸¢à¸‡à¸à¸±à¸à¸©à¸£à¸•à¸±à¸§à¹à¸£à¸à¹€à¸›à¹‡à¸™à¸•à¸±à¸§à¸žà¸´à¸¡à¸žà¹Œà¹ƒà¸«à¸à¹ˆà¹€à¸—่านั้น มีà¸à¸²à¸£à¹€à¸žà¸´à¹ˆà¸¡ “Garan†(à¸à¸²à¸£à¸±à¸™à¸•à¹Œ - ชื่à¸à¸ªà¸²à¸¡à¸±à¸) เป็นนามà¹à¸à¸‡à¸ªà¸³à¸«à¸£à¸±à¸šà¸Šà¸·à¹ˆà¸ à¸à¸¢à¹ˆà¸²à¸‡à¹€à¸›à¹‡à¸™à¸—างà¸à¸²à¸£à¸§à¹ˆà¸² ธัณฑฆาต (ซึ่งเป็นคำที่ใช้ไม่ธรรมดา) USAGE NOTES Each of the defined properties may be accessed by either form: \p{InProperty} -OR- \p{IsProperty} For example, \p{InThaiVowel} and \p{IsThaiVowel} have identical implementation--there is no difference between them. This flexibility is built-in on account of ambiguities in the formats used by various codebases, and the fact that Perl supports both. TO VIEW ALL CHARACTERS OF A CLASS... You may list the codepoints of a character class by simply calling that class as an ordinary function. For example: my @chars = &InThaiCompVowel; print @chars; This will print: 0E31 0E34 0E35 0E36 0E37 0E38 0E39 0E3A 0E47 0E4D To print them as the actual UTF8 characters these codepoints represent, try this: my @chars = split(/\n/, InThaiPreVowel); foreach my $char (@chars) { print chr(hex($char)); } INSTALLATION To install this module type the following: perl Makefile.PL make make test make install BUGS COMBINATIONS Combinations cannot be handled by this module. The doubled ร consonant (รร) in some syllables becomes vowel + consonant; whereas it will only be counted as a consonant here. CONSONANT CLUSTERS This feature (InThaiDualCons, InThaiDualC1, InThaiDualC2, etc.) is considered experimental and likely incomplete. Please send the author additions for this list if you find it incomplete. AMBIGUITIES Where a character can function as either consonant or vowel, it may get included in both categories, i.e. it may match either one. This includes the Thai 0E24 (ฤ) and 0E26 (ฦ) characters which are considered “sonorant†consonants by some, and strictly as vowels by others. PREREQUISITES Perl 5.8.3 or newer Exporter 5.57 or newer utf8 AUTHOR Erik Mundall <emundall@biblasia.com>. COPYRIGHT and LICENSE Regexp::CharClasses::Thai is designed to enable detailed regular expressions, with the ability to identify important characteristics of Thai alphabetic characters, digits and symbols. Copyright (C) 2023 Erik Mundall This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see: https://www.gnu.org/licenses/. CHALLENGE “Whatever your hand finds to do, do it with your might; for there is no work, nor device, nor knowledge, nor wisdom, in the grave, where you go.†--Ecclesiastes 9:10 “มืà¸à¸‚à¸à¸‡à¹€à¸ˆà¹‰à¸²à¸ˆà¸±à¸šà¸—ำà¸à¸²à¸£à¸‡à¸²à¸™à¸à¸°à¹„ร จงà¸à¸£à¸°à¸—ำà¸à¸²à¸£à¸™à¸±à¹‰à¸™à¸”้วยเต็มà¸à¸³à¸¥à¸±à¸‡à¸‚à¸à¸‡à¹€à¸ˆà¹‰à¸² เพราะว่าในà¹à¸”นคนตายที่เจ้าจะไปนั้นไม่มีà¸à¸²à¸£à¸‡à¸²à¸™ หรืà¸à¹à¸™à¸§à¸„วามคิด หรืà¸à¸„วามรู้ หรืà¸à¸ªà¸•à¸´à¸›à¸±à¸à¸à¸²â€ --ปัà¸à¸à¸²à¸ˆà¸²à¸£à¸¢à¹Œ ๙:๑à¹