§

नमुना

ध्वज
§

चाचणी मजकूर

§

जुळणारे

० जुळणारे

    अद्याप matches नाहीत — वर pattern आणि test string type करा.

    §

    बदलण्याचा मोड

    त्वरित संदर्भ

    अक्षर वर्ग

    \d
    कोणताही digit, [0-9] शी equivalent.
    \w
    कोणताही word character — letters, digits, किंवा underscore.
    \s
    कोणताही whitespace — space, tab, newline, इ.

    अँकर

    \b
    Word boundary वर zero-width assertion.
    ^
    Input चा सुरुवात (किंवा m flag set असल्यास प्रत्येक line चा).
    $
    Input चा शेवट (किंवा m flag set असल्यास प्रत्येक line चा).

    परिमाण

    *
    मागील token चे शून्य किंवा अधिक, greedy.
    +
    मागील token चे एक किंवा अधिक, greedy.
    ?
    मागील token चे शून्य किंवा एक — आधीचा quantifier lazy पण बनवतो.
    {n,m}
    मागील token चे n ते m repetitions दरम्यान.

    समूह

    (...)
    Capturing group — replacements मध्ये $1, $2, … म्हणून exposed.
    (?:...)
    Non-capturing group — slot consume न करता groups.
    (?...)
    Named capturing group — replacements मध्ये $ म्हणून exposed.

    Lookaround

    (?=...)
    Positive lookahead — फक्त … ने followed असल्यास match करा
    (?!...)
    Negative lookahead — … ने followed नसल्यासच match करा
    (?<=...)
    Positive lookbehind — फक्त … ने preceded असल्यास match करा
    (?
    Negative lookbehind — … ने preceded नसल्यासच match करा

    Escapes

    \\
    Literal backslash character.
    \.
    Literal dot — literally match करण्यासाठी कोणताही metacharacter escape करा.

    JavaScript regular expressions भारतातील developer work मध्ये सर्वत्र आहेत. Razorpay, Paytm, आणि UPI apps मधील phone number validation, Aadhaar आणि PAN format checking, GST invoice number patterns, आणि Shopify India stores मध्ये SKU validation — सर्व ECMAScript regex engine वापरतात. Bengaluru, Pune, आणि Hyderabad च्या backend engineers Apache logs parse करण्यासाठी, input sanitization साठी, आणि commit-message conventions enforce करण्यासाठी regex वापरतात. हा tester production प्रमाणेच in-browser `RegExp` constructor वापरतो, त्यामुळे तुम्ही इथे test केलेले expression production code मध्ये bit-identical असेल.

    Browser मध्ये regex कसे कार्य करते?

    प्रत्येक JavaScript runtime native regular expression engine ship करतो — new RegExp(pattern, flags) तुमचा pattern compile करतो, नंतर String.prototype.match, String.prototype.replace, आणि RegExp.prototype.exec सारखे methods ते कोणत्याही input string विरुद्ध drive करतात. हे tester त्या engine ला UI मध्ये wrap करतो जेणेकरून तुम्ही browser सोडल्याशिवाय patterns edit, run, आणि inspect करू शकता. तुम्ही type करता ते काहीही — pattern, flags, test string, किंवा replacement — network वर send होत नाही.

    Regex tester कसे कार्य करते?

    Pipeline काही short steps आहेत, जे सर्व प्रत्येक keystroke वर client-side run होतात (typing fluid राहण्यासाठी 150 ms ला debounced):

    1. तुमचा pattern body वरील input मधून read केला जातो (leading किंवा trailing / delimiters नाहीत — ते decorative आहेत). निवडलेले flag pills gi किंवा gimsuy सारख्या flags string मध्ये concatenated होतात.
    2. new RegExp(patternBody, flags) pattern compile करतो. Engine SyntaxError throw केल्यास (उदा. unmatched parenthesis किंवा invalid escape), message test string वर rendered होतो आणि match list cleared होतो. Compile error हे V8 / SpiderMonkey / JavaScriptCore मधून actual err.message आहे त्यामुळे DevTools मध्ये दिसणाऱ्याशी जुळते.
    3. Match list साठी, tester नेहमी synthetic global flag सोबत enumerate करतो — त्यामुळे g बंद केले तरी list अजूनही प्रत्येक match दाखवते. Standard zero-width-match guard (if (m.index === rx.lastIndex) rx.lastIndex++) loop empty string match करणाऱ्या patterns वर spinning पासून ठेवतो. Replace mode तुमचा real flag set honour करतो त्यामुळे $& String.prototype.replace प्रमाणे वागतो.
    4. प्रत्येक iteration दरम्यान tester performance.now() - start check करतो आणि 50 ms निघून गेल्यावर abort करतो. हे (a+)+$ सारख्या a च्या long run विरुद्ध catastrophic backtracking पासून रक्षण करतो — अन्यथा tab hang होईल. Guard best-effort आहे: एका exec call मध्ये pathological single-match pattern अजूनही time consume करू शकतो. असे झाल्यास, tab refresh करा आणि non-greedy quantifier किंवा atomic-style possessive (उदा. [^x]*x) सोबत pattern rewrite करा.
    5. Test string प्रत्येक match च्या range वर segments मध्ये split होतो आणि matched segments <mark class="rx-match rx-cap-N"> elements मध्ये wrapped होतात, जिथे N सहा palette colours मध्ये cycles करतो जेणेकरून adjacent matches एका नजरेत सहज ओळखता येतात. प्रत्येक match चे numbered groups (m[1], m[2], …) आणि named groups (m.groups) खाली labelled rows म्हणून rendered होतात; d flag set असल्यास per-group [start, end] indices पण दाखवल्या जातात.

    हा regex tester का वापरायचा?

    • Privacy: प्रत्येक pattern, test string, आणि replacement browser मध्ये built-in JavaScript RegExp engine वापरून run होतो. Tab सोडत काहीही नाही — input customer log, leaked credential pattern, किंवा hosted SaaS regex playground मध्ये paste करणार नाही असे काहीही असल्यावर महत्त्वाचे.
    • Honest flavor: tester Node.js, Chrome, Safari, Firefox, आणि प्रत्येक browser-based form validator run करणारा exact regex engine expose करतो. Subtle differences लपवण्यासाठी Perl-flavor translation layer नाही — इथे काम करते ते तुमच्या code मध्ये काम करते.
    • Capture आणि named-group debugging: प्रत्येक numbered group ($1, $2, …) आणि named group ($<year>) प्रत्येक match साठी दाखवला जातो जेणेकरून तुम्ही parser build करू शकता आणि slots back read करू शकता guess न करता. Replace mode तुम्हाला groups freely mix करू देतो — $2-$1 पहिले दोन slots swap करतो, $<name> named slot drop करतो, आणि $& संपूर्ण match echo करतो.
    • Catastrophic-backtracking guard: enumeration वर 50 ms ceiling (a+)+$ सारखे pathological patterns tab freeze होण्यापूर्वी abort करतो. Hung browser ऐवजी explanatory error दिसतो, आणि page लगेच recover होतो.

    Regex tester चे सामान्य उपयोग काय आहेत?

    Regular expressions web development, security, आणि data work मध्ये येतात — हा tester सर्वात सामान्य use cases target करतो:

    • Form validation: email, phone, किंवा postal-code pattern prototype करा, test string मध्ये sample inputs paste करा, आणि pattern production code ला ship करण्यापूर्वी प्रत्येक positive case match होतो आणि प्रत्येक negative case होत नाही याची confirm करा.
    • Log scraping: NGINX, application, किंवा audit-log output चा chunk paste करा, तुम्हाला care असलेल्या parts साठी named groups सोबत pattern लिहा ((?<ip>…) (?<path>…)), आणि तुमचा parser correct आहे याची confirm करण्यासाठी प्रत्येक match चे captured slots read करा.
    • Refactor search-and-replace: snippet मध्ये identifiers rewrite करण्यासाठी Replace mode वापरा — (\w+)\.set(\w+)\($1.$2 = getter calls property assignments मध्ये turns करतो, आणि live preview codemod ला commit करण्यापूर्वी result दाखवतो.

    Regex उदाहरण कसे दिसते?

    g flag सोबत pattern (\d{4})-(\d{2})-(\d{2}) घ्या, test string release 2025-11-15, prerelease 2026-05-25 विरुद्ध run करा. Engine दोन matches शोधतो. पहिला match 2025-11-15 group 1 = 2025, group 2 = 11, group 3 = 15 सोबत. दुसरा match 2026-05-25 तोच group shape सोबत. Replace mode मध्ये, replacement template $3/$2/$1 दोन्ही dates 15/11/2025 आणि 25/05/2026 ला rewrite करतो — एक one-pattern ISO-to-DMY conversion जे तुम्ही script मध्ये pattern plug करण्यापूर्वी visually verify करू शकता.

    कोणत्याही regex work साठी — patterns build, debug, किंवा rewrite करताना — हे tester fast path म्हणून वापरा. सर्व काही locally run होते; काहीही logged होत नाही; regex engine तुमचा browser जे काही ship करतो ते आहे, त्यामुळे behaviour production code runtime वर जे दिसेल त्याशी जुळते.