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·2026-01-20 02:14
Updated·2026-01-20 02:28
Flavor·Python

r"
(?P<image>(?P<repo>(?:(?P<registry>(?P<host>(?:[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9])(?:[.](?:[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9]))+|(?:\[[a-fA-F0-9:]+\]))(?:[:](?P<port>[0-9]+))?)[/])?(?P<name>(?:[a-z0-9]+(?:(?:[._]|__|[-]*)[a-z0-9]+)*)(?:[/][a-z0-9]+(?:(?:[._]|__|[-]*)[a-z0-9]+)*)*))(?P<reference>(?:[:](?P<tag>[\w][\w.-]{0,127}))?(?:(?(tag)$|[@](?P<digest>[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][A-Fa-f0-9]{32,})))?))
"
gm
Open regex in editor

Description

This is a Python RE for matching different parts and combinations of various docker/container image references, as compatible with docker pull etc.

Parts / Capture Groups

image:  # whole image
  repo:  # everything but the tag/digest
    registry:  # host+port
      host:
      port:
    name:  # path within registry
  reference:  # tag or digest (with `:` or `@`; I haven't bothered to figure out how to strip that yet)
    tag:
    digest:

If it matches, it should match image, repo, and name at the very least.

Submitted by neal-ian