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

0

Regular Expression
Created·2023-04-02 00:12
Updated·2025-04-08 14:41
Flavor·PCRE2 (PHP)

/
(?:"?[a-z0-9_\-]{0,256}(?:key|secret|token)[a-z0-9_\-]{0,256}"?\s{0,10}(?::|=)\s{0,10}\"?(?!null|true|false)([a-z0-9+_:\.\-\/]{1,1024})|"Authorization":"[a-z0-9+:_\-\/]{1,1024}\s(.{1,1024}?(?<!\\)(?=")))
/
gmi
Open regex in editor

Description

Given a JSON.stringified object that may contain secrets, obfuscate them for logging. It will match parameters with "token," "key," and "secret" in strings and key/value pairs. Specifically looks for object values with : setters``, strings with = setters and Authorization headers.

This regex will produce 2 groups for each match.

  • Group 1 will have object key/values and = param value pairs from strings such as query strings.
  • Group 2 will have authorization header keys
{
   secret: "hdsuaskleasdkfjs8e229das-43332",
   urls: {
      uri_1: "https://www.api.example.com/api/?count=433&apiKey=DD2EXAMPLE248330EFBB58D6B1431AFB03C8E1D&debug=true",
      uri_7: "https://www.api.example.com/api/?api_key=7119EXAMPLE25C366F9AB506A1BFD&debug=true"
   },
   secret-pin:123456789,
   headers: {Authorization: "Bearer dasd/4EXAMPLEuCoAO8UaxuWUGXUtuzRJKdRTvKMVe3dJ9FN1SyF9n=="},
      auth_3: {Authorization: "App D4DEXAMPLE0BB1B2F12B5E97405C764CA45F"},
      auth_4: {Authorization: "IPSO dasd+F51EXAMPLEB63334AD3520894712D15D8F1105ED3DD"},
      auth_5: {Authorization: "Key hJdilwrEXAMPLEzM9616MJsDGBiK4qjeJFYB0zmHPxYNUrn8D54ycAN7gwedqHt0UiCWTb"},
auth_8: {Authorization: "Digest username=EXAMPLE, nonce=h8A4EXAMPLEZW22ygGZozIIGZcb43waVMEM6Gq, response='b4543cd4dEXAMPLE6a923b4ab4fd4583af48f0e'}
   },
   apiKey: null,
   apiKey3: true,
   apiKey4: false,
   apiKey5: 'null',
   apiKey6: 'true'
}
Submitted by chadkluck