Regular Expressions 101

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·2025-04-27 00:18
Flavor·ECMAScript (JavaScript)

'
class MyNewLanguage extends PureComponent { // // Proptypes static propTypes = { regex: PropTypes.string.isRequired, flags: PropTypes.string.isRequired, delimiter: PropTypes.string.isRequired, testString: PropTypes.string.isRequired, isSubstituting: PropTypes.bool.isRequired, isGlobal: PropTypes.bool.isRequired, substString: PropTypes.string }; // // Control // If you need to manipulate any data, you should preferably do it in a function defined // on the class body here. This could for example be sanitizing data (escaping quotes, etc). // // Render functions render() { return ( <Highlight lang="myNewLanguage"> {this._renderCode()} </Highlight> ); } _renderCode() { const { regex, flags, delimiter, testString, isSubstituting, substString, isGlobal } = this.props; const codeString = new CodeString(); // CodeString is a basic class that allows you to create a code snippet without having // to worry about indentation or newlines. // The only functions are `append`, `indent` and `toString`. // The implementation can be found on this page. // Create your code string here codeString.append(`Use string literals when ${regex} interpolating ${flags} data`); return codeString.toString(); } } export default MyNewLangauge;
'
gm
Open regex in editor

Description

  1. PropTypes.string# ``
Submitted by Khaliq88