WikiPlus

Tester Regex

Testuj i debuguj wyrażenia regularne w czasie rzeczywistym. 100% za darmo, działa w przeglądarce.

Przetwarzanie lokalne
Średnio 1.4s
4.8 z 5 — na podstawie 1,247 uzyc

Autor: Sergio Robles — Założyciel

Twoje pliki są przetwarzane lokalnie w przeglądarce. Nigdy nie przesyłamy ani nie przechowujemy Twoich danych.

Co to jest Tester Regex?

Regex Tester uruchamia Twoje wyrazenie regularne na przykladowym tekscie. Zaznacza kazde dopasowanie w czasie rzeczywistym podczas pisania. Przelacz flagi global, case, multiline, dotall, sticky i unicode jednym kliknieciem. Tester uruchamia sie ponownie przy kazdym nacisniecieu klawisza. Pokazuje grupy, pozycje poczatku i konca kazdego dopasowania oraz calkowita liczbe. Silnikiem jest natywny RegExp przegladarki. Dopasowania tutaj sa takie same jak w Twoim prawdziwym kodzie JS. Deweloperzy uzywaja go do walidacji formularzy, parserow logow i budowy slugow. Kazdy, kto uczy sie regex, dostaje natychmiastowy wizualny feedback. Grupy pokazuja sie po numerze lub nazwie. Typowe zadania obejmuja czyszczenie logow z e-maili i numerow kart. Pomaga tez sprawdzic ksztalty danych wejsciowych przed wyslaniem formularza.

Kiedy powinienem użyć tego narzędzia?

  • Przetestuj wzorzec walidacji e-maila przed wdrożeniem formularza rejestracji
  • Zweryfikuj, czy regex slugu URL pasuje do każdej oczekiwanej ścieżki wpisu bloga
  • Debuguj grupę przechwytującą podczas scrapowania komunikatów błędów z logów
  • Prototypuj wzorzec znajdź-zamień przed uruchomieniem go na produkcji

Jak przetestować wyrażenie regularne?

  1. 1Wpisz lub wklej swoj wzorzec regex w polu wyrazenia.
  2. 2Przelacz flagi, takie jak globalny, ignorowanie wielkosci liter lub wieloliniowy.
  3. 3Wklej przykladowy tekst do dopasowania w obszarze tresci.
  4. 4Obserwuj dopasowania podswietlane na zywo i sprawdz kazda grupe przechwytywania.
  5. 5Skopiuj gotowy wzorzec do swojego kodu lub pipeline CI.

Często zadawane pytania

Jakiego dialektu regex uzywa ten tester?

The tester runs the same ECMAScript regular expression engine that ships in your web browser — the same engine used by Node.js, Deno, and every Chromium-based or Firefox-based runtime. This matters because regex dialects differ in meaningful ways across languages, and testing in the wrong engine gives false confidence. The JavaScript engine supports the full ES2024 feature set, including named capture groups with the (?<name>...) syntax, Unicode mode activated by the /u flag, Unicode set notation activated by /v, lookbehind assertions of both positive (?<=...) and negative (?<!...) forms, the dotAll flag /s that makes . match newline characters, and the sticky flag /y that anchors the match to lastIndex rather than scanning. Features exclusive to other dialects are not available here. These include atomic groups (?>...) from PCRE and .NET, possessive quantifiers like a++ from Java, and variable-length lookbehind of the kind Python 3.x permits. If your production code is JavaScript or TypeScript running in a browser or Node.js, what passes here is guaranteed to behave identically in production. If you are porting a pattern to Python's re module, PHP's PCRE extension, or Go's RE2 engine, treat the result here as a starting reference and verify edge cases in the target engine. The tool exposes all six standard JS flags — g, i, m, s, u, y — as individual toggles so you can test the exact flag combination your code will use.

Jak aktualizuja sie podswietlenia podczas pisania?

Every keystroke in either the pattern input or the test-string area triggers a synchronous re-evaluation cycle. The tester first attempts to compile the current pattern string into a RegExp object using the active flag set. If compilation throws a SyntaxError — for example, due to an unmatched parenthesis or an invalid flag — the pattern input border turns red and an error message shows the exact parse failure. No match attempt is made. If compilation succeeds, the engine runs the pattern against the full test string. In global mode the engine iterates through all non-overlapping matches and records the start index, end index, and all capture-group values for each. In non-global mode only the first match is collected. The DOM then receives updated highlight spans injected around each matched character range, color-coded by group number so nested captures are visually distinct. The entire cycle runs on the browser's main thread. Patterns that trigger catastrophic backtracking — the classic example is /(a+)+b/ tested against a long sequence of the letter a — can stall the thread for several seconds. To protect the tab, a 1 000-millisecond timeout aborts any match attempt that runs too long. When the timeout fires, a red warning banner identifies the pattern as potentially unsafe and recommends adding a possessive quantifier or atomic group equivalent. This prevents the tab from becoming unresponsive during exploration of untested patterns against large inputs.

Czy moge zapisac wzorce, czy wszystko znika po odswiezeniu?

The tester automatically persists the current pattern, the selected flags, and the test-string content to the browser's localStorage under a key scoped to the WikiPlus origin. This save happens on every change with a short debounce, so you never need to click a save button. When you reopen the page — even after closing the tab or rebooting — the previous session is restored in full, including the capture-group summary panel. The saved state exists only in the browser profile on the device where it was entered. It is never synced to WikiPlus servers. Opening the same URL in an incognito or private window, or on a different device, starts with a blank tester. Clearing site data via browser settings also wipes the saved state. For sharing patterns with a colleague, the tester provides a share button that URL-encodes the pattern, flags, and a sample test string into the hash fragment — the portion of the URL after the # character. The hash is never sent to the server, so the shared URL does not expose the pattern to WikiPlus infrastructure. The recipient opens the link and sees the exact tester state you configured. For long-term storage of important patterns, copy them into a code comment, a README, or a team knowledge base. localStorage is persistent but not a reliable archive — users routinely clear browser data. The share URL approach is the safest way to hand off a finished pattern.

Dlaczego moj wzorzec dziala inaczej w Python lub PHP?

Every programming language ships its own regex engine, and the engines differ in feature set, default behavior, and edge-case handling in ways that look minor but produce subtly wrong results in production. Python's re module uses its own flavor. It supports variable-length lookbehind that JavaScript rejects. It also treats \w as ASCII-only by default unless you pass re.UNICODE. PHP uses the PCRE2 library, which adds atomic groups, possessive quantifiers, recursive patterns, and callout functions — none of which exist in JavaScript. Java's java.util.regex implements yet another dialect with possessive quantifiers and different Unicode category handling. Go's RE2 engine deliberately omits all backtracking features, including lookahead and lookbehind, to guarantee linear-time matching. The meaning of \b word boundaries around Unicode letters also varies: JavaScript in /u mode treats Unicode letters as word characters, but many older engines treat only ASCII letters as word characters, making \b match at unexpected positions inside words that contain accented characters. Even the handling of \d differs — in some engines it matches only 0–9, in others it matches all Unicode decimal digit categories. When you test a pattern here for use in Python, PHP, or Go, treat the result as a functional draft and run a language-specific test suite before shipping. The most reliable approach is always to test the pattern inside the exact runtime your code will use.

Tresc tej strony jest dostepna na licencji CC BY 4.0.