डेव टूल्स/Regex टेस्टर
Regex टेस्टर
लाइव मैचिंग के साथ रेगुलर एक्सप्रेशन का परीक्षण और डिबग करें
पैटर्न
टेस्ट स्ट्रिंग
मैच (0 मैच मिले)
कोई मैच नहीं मिला
Regular Expressions Guide
Learn how to test and debug regular expressions
What are Regular Expressions?
Regular expressions (regex) are patterns used to match character combinations in strings. They are powerful tools for searching, validating, and manipulating text data in programming.
How to Use This Tool
- Enter your regex pattern in the pattern field
- Select the flags you need (global, case-insensitive, multiline)
- Enter or paste your test text in the test string field
- View highlighted matches and match details in real-time
Pro Tips
- Use the global flag (g) to find all matches, not just the first one
- The multiline flag (m) makes ^ and $ match line starts/ends
- Escape special characters like . * + ? with a backslash (\)
Browser Support
Regular expressions are natively supported in all modern browsers through JavaScript's RegExp object. This tool uses standard JavaScript regex syntax.
अक्सर पूछे जाने वाले प्रश्न
रेगुलर एक्सप्रेशन में g, i, m फ्लैग क्या हैं?
g (global) सभी मैच ढूंढता है, i (insensitive) केस को अनदेखा करता है, और m (multiline) ^ और $ को हर लाइन की शुरुआत/अंत से मैच कराता है। आप कई फ्लैग एक साथ उपयोग कर सकते हैं।
स्पेशल कैरेक्टर्स को लिटरली सर्च करने के लिए क्या करें?
बैकस्लैश (\) से एस्केप करें। उदाहरण के लिए, डॉट खोजने के लिए \. का उपयोग करें। स्पेशल कैरेक्टर्स में . * + ? ^ $ { } [ ] ( ) | \ शामिल हैं।
ईमेल वैलिडेशन के लिए उचित regex क्या है?
पूर्ण ईमेल वैलिडेशन बहुत जटिल है। सरल पैटर्न के लिए ^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,}$ का उपयोग किया जा सकता है, लेकिन वास्तविक सेवाओं में ईमेल भेजकर पुष्टि करना अधिक विश्वसनीय है।
.* और .*? में क्या अंतर है?
.* greedy है और जितना संभव हो उतना मैच करता है, जबकि .*? lazy है और जितना कम हो उतना मैच करता है। HTML टैग कंटेंट निकालते समय <.*?> का उपयोग करने से अलग-अलग टैग मैच होते हैं।
regex में ग्रुप कैप्चर कैसे उपयोग करें?
कोष्ठक () से ग्रुप बनाकर मैच किए गए हिस्से को कैप्चर करें। परिणाम में groups[1], groups[2] आदि से एक्सेस कर सकते हैं। बिना कैप्चर के केवल ग्रुप बनाने के लिए (?:...) का उपयोग करें।