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

2

Regular Expression
Created·2016-02-15 21:37
Flavor·PCRE (Legacy)

/
^ (?# Piece Placement Section)(?<PiecePlacement>((?<RankItem>[pnbrqkPNBRQK1-8]{1,8})\/?){8}) (?# Section Separator)\s+ (?# Side To Move Section) (?<SideToMove>b|w) (?# Section Separator)\s+ (?# Castling Ability) (?<Castling>-|K?Q?k?q) (?# Section Separator)\s+ (?# En passant) (?<EnPassant>-|[a-h][3-6]) (?# Section Separator)\s+ (?# Half Move Clock) (?<HalfMoveClock>\d+) (?# Section Separator)\s+ (?# Full Move Number) (?<FullMoveNumber>\d+) \s* $
/
x
Open regex in editor

Description

This will match an FEN string (https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation). It is not strict in having each rank separated by a '' character, although it is strict in the order of characters for the Castling section. Anything not following the order of KQkq in the case where castling is available, will fail the Regex. It is also case sensitive for the Side and the "en passant" column letter.

Submitted by NazarioJL