RegEx 生成器

⚡ 正則表達式 (Pattern)

//g

📝 即時測試與匹配沙盒

🧱 智慧 POSIX 積木

📦 實戰代碼片段

定義正則
const regex = /[a-zA-Z0-9]+/g;
判斷布林值
const isMatch = regex.test(text);
提取單一匹配
const firstMatch = text.match(regex)?.[0];
提取所有匹配 (陣列)
const allMatches = [...text.matchAll(regex)].map(m => m[0]);