Community Patterns

1

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

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

Community Library Entry

1

Regular Expression
Created·2020-12-20 10:53
Flavor·ECMAScript (JavaScript)

/
^(?:[\w]\:|\/)(\/[a-z_\-\s0-9\.]+)+\.(txt|gif|pdf|doc|docx|xls|xlsx|js)$
/
i
Open regex in editor

Description

Recently, I was looking for a regular expression to validate a file path and extension. I found several of them on Google, but none of them fit my requirement. So I decided to put together a version that suits my need. Here is the Regular Expression to validate the file path and extension and it is compatible with JavaScript and ASP.NET. I hope someone will find this information useful and that it will make your programming job easier.

Hide Copy Code ^(?:[\w]:|\)(\[a-z_-\s0-9.]+)+.(txt|gif|pdf|doc|docx|xls|xlsx)$ Explanation Hide Copy Code ^(?:[\w]:|\) -- Begin with x:\ or \

[a-z_-\s0-9.] -- valid characters are a-z| 0-9|-|.|_ (you can add more)

(txt|gif|pdf|doc|docx|xls|xlsx) -- Valid extension (you can add more) Matches Hide Copy Code \192.168.0.1\folder\file.pdf \192.168.0.1\my folder\folder.2\file.gif c:\my folder\abc abc.docx c:\my-folder\another_folder\abc.v2.docx Non-Matches Hide Copy Code \192.168.0.1\folder\fi<le.pdf \192.168.0.1\folder\file.pdf \192.168.0.1\my folder\folder.2.gif c:\my folder\another_folder.docx c:\my folder\another_folder\abc.docx c:\my folder\another_folder\ab*c.v2.docx c:\my?folder\another_folder\abc.v2.docx file.xls

Submitted by anonymous