Regular Expressions 101

Community Patterns

1

ตรวจสอบพยัญชนะต้นตัวสะกดสระและวรรณยุกต์ไทย

Created·2026-01-22 01:36
Updated·2026-01-23 12:42
Flavor·JavaScript
ตรวจสอบพยัญชนะต้น (ต้องมี) ตรวจตัวสะกดสำหรับสระที่ต้องมี ตรวจสอบการวางสระและวรรณยุกต์ไทย หมายเหตุ การตรวจสอบตัวสะกดในภาษาไทยตรวจสอบได้ยากเพราะภาษาไทยเป็นภาษาที่เขียนติด ๆ กันไม่มีการแบ่งคำอย่างชัดเจนทำให้การอ่านภาษาไทยผู้อ่านต้องใช้ความหมายของคำในการตัดสินการอ่านแบ่งคำตามความเหมาะสมเช่นคำว่า "ตากลม" อาจอ่านเป็น "ตาก-ลม" ก็ได้ หรืออ่านเป็น "ตา-กลม"ก็ได้ ดังนั้นการเขียน Regex เพื่อทำการตรวจสอบอาจช่วยได้ระดับหนึ่ง อ่าจมีผิดบ้างถูกบ้าง แต่ก็ถือว่าเป็นเครื่องมือที่ใช้ช่วยเหลือในการตรวจสอบเพิ่มเติมได้ 80% ของความเป็นไปใด้ก็แล้วกันนะครับ หวังว่าการเขียนเพิ่มเติมส่วนนี้ จะมีประโยชน์บ้างไม่มากก็น้อย
Submitted by อธิปัตย์ ล้อวงศ์งาม

Community Library Entry

0

Regular Expression
Created·2021-03-11 15:46
Flavor·Python

r"
'^p( ( ( (24 ( (ep) | (f[jv]?) | (hj) ) ) (\d{1,4}) [a-z]{2} \d{3} ([a-z]?))) | 30f \d{4} [a-z]?| 33( ( c [hk] \d{1,4} m[cp] \d{3} (s1)? ) | ( e (p|dv?|v) \d{2,3} [a-z]{2} \d{2,4} ) | (fj \d{1,4} (mc|g[sp]) \d{3} a?)) ) \.gld$
"
gmix
Open regex in editor

Description

Created for a Python program that needed to help recognize linker script filenames that resemble those for actual devices in Microchip's 16-bit DSC/MCU family of chips.

The regex will match any such filename found in Microchip's xc16 support directory tree, as of xc16 v1.50. (I've actually tested it on all of them).

It will also match filenames that don't correspond to anything supplied by Microchip in xc16 v1.50. But it's still useful to help spot filenames that are very dissimilar to the ones Microchip provides.

Submitted by Galen Tackett