डेवलपर

Regex टेस्टर और एक्सट्रैक्टर

Regex pattern को real-time में टेस्ट करें, match highlight देखें, capture groups inspect करें और code snippet बनाएं।

Regex वर्कस्पेस
मिलान: 2
हाइलाइट किया गया परिणाम
product-120
order-42
invalid
कैप्चर ग्रुप
#पूरा मिलानसमूह
1product-120g1: product | g2: 120
2order-42g1: order | g2: 42
संदर्भ

Regex चीट शीट

टोकनअर्थ
.Any character except newline
\dDigit (0-9)
\wWord character
\sWhitespace
^ / $Start / end of line
[abc]Any character in class
[^abc]Any character not in class
( ... )Capture group
(?: ... )Non-capturing group
a|bAlternation
* + ?Quantifiers
{n,m}Range quantifier

कोड स्निपेट

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

आपको यह भी पसंद आ सकता है