Developer
Regex Tester & Extractor
ทดสอบ regex แบบเรียลไทม์ ไฮไลต์ผลลัพธ์ ดู capture groups และสร้าง code snippet
Regex Workspace
Matches: 2HIGHLIGHT RESULT
product-120 order-42 invalid
CAPTURE GROUPS
| # | Full Match | Groups |
|---|---|---|
| 1 | product-120 | g1: product | g2: 120 |
| 2 | order-42 | g1: order | g2: 42 |
Reference
Regex Cheat Sheet
| Token | Meaning |
|---|---|
| . | Any character except newline |
| \d | Digit (0-9) |
| \w | Word character |
| \s | Whitespace |
| ^ / $ | Start / end of line |
| [abc] | Any character in class |
| [^abc] | Any character not in class |
| ( ... ) | Capture group |
| (?: ... ) | Non-capturing group |
| a|b | Alternation |
| * + ? | Quantifiers |
| {n,m} | Range quantifier |
Code Snippet
const regex = new RegExp('(\\w+)-(\\d+)', 'g');
const text = 'product-120
order-42
invalid';
const matches = [...text.matchAll(regex.global ? regex : new RegExp(regex.source, regex.flags + 'g'))];
console.log(matches);Share
คุณอาจชอบสิ่งนี้ด้วย
- ตัวค้นหา JSON Pathตรวจสอบ JSON คัดลอก JSONPath ที่แม่นยำ และทดสอบ path ในเบราว์เซอร์
- URL Encoder Decoderเข้ารหัสและถอดรหัส URL component ในเบราว์เซอร์ของคุณ
- Base64 Encoder Decoderเข้ารหัสและถอดรหัสข้อความ Base64 ในเบราว์เซอร์ของคุณ
- GUID / UUID Generatorสร้าง UUID และแปลง GUID เป็น short GUID ในเบราว์เซอร์ของคุณ
- JSON Formatterจัดรูปแบบ ตรวจสอบ และบีบอัด JSON ทันที คลิกเดียวเพื่อคัดลอก
- ตัวแปล Cronแยกวิเคราะห์บรรทัด crontab แบบเต็มพร้อมคำสั่ง อธิบายตารางเวลา และแสดงเวลาเรียกใช้อีก 5 ครั้งถัดไป
- ดูตัวอย่าง HTMLเขียนหรือวาง HTML และดูตัวอย่างแบบเรียลไทม์ใน sandbox iframe รองรับหน้าเต็มและ fragment
- JWT Decoderถอดรหัสและตรวจสอบ JWT token ทันที ดู header, payload claims และสถานะหมดอายุ
- Number Base ConverterInstantly convert numbers between binary, octal, decimal, and hexadecimal. Supports large numbers. 100% client-side.
- ตัวแปลง Unix Timestampแปลง epoch Unix เป็นวันที่/เวลา และกลับกัน 100% client-side