Installera ZYBERMART

Öppna alla verktyg från hemskärmen eller Dock, i ett eget fönster. Verktyg du har använt fungerar även offline.

Regex-testare

Testa reguljära uttryck med träffar markerade i realtid, fångstgrupper, flaggor och förhandsvisning av ersättning.

/ / g

#MatchIndexGroups

Regex cheat sheet

PatternMatches
.Any character except a newline
\d \w \sDigit, word character (letter, digit, _), whitespace
[abc] [^abc] [a-z]One of a, b or c; anything but them; a range
* + ?0 or more, 1 or more, 0 or 1 (add ? to make lazy)
{2} {2,} {2,5}Exactly 2, at least 2, between 2 and 5
^ $ \bStart of text/line, end of text/line, word boundary
(…) (?:…) (?<name>…)Capture group, non-capturing group, named group
a|ba or b
(?=…) (?!…) (?<=…)Lookahead, negative lookahead, lookbehind

Useful patterns

  • Email address (simple): [\w.+-]+@[\w-]+\.[\w.-]+
  • URL: https?:\/\/[^\s]+
  • Date YYYY-MM-DD: \d{4}-\d{2}-\d{2}
  • Hex color: #(?:[0-9a-fA-F]{3}){1,2}\b
  • Extra spaces: {2,} (replace with one space)

Frequently asked questions

Which regex flavor does this tester use?

It uses JavaScript (ECMAScript) regular expressions, the same engine as your browser and Node.js. Most syntax is shared with Python, Java, C# and PCRE, but features such as lookbehind, named groups and Unicode classes can differ slightly between languages.

What do the flags mean?

g finds all matches instead of just the first, i ignores case, m makes ^ and $ match at line breaks, s lets . match newlines, u enables full Unicode support, and y (sticky) only matches at the current position.

How do I use capture groups in the replacement?

Use $1, $2 and so on for numbered groups, $<name> for named groups, and $& for the whole match. For example, replacing (\w+)@(\w+) with $2 at $1 swaps the two parts.

Why does my pattern stop with “took too long”?

Some patterns, especially nested quantifiers like (a+)+, can take exponential time on certain input. The tester runs your regex in a background worker and stops it after a second, so the page never freezes. Simplify the pattern to fix it.

Logga in på ZYBERMART

Ha dina CV:n, fakturor, flashcards, anteckningar och sparade verktyg på alla dina enheter. Det är gratis, och verktygen fungerar likadant utan konto.

eller

Inget lösenord behövs. Genom att logga in godkänner du villkoren. Läs hur vi hanterar dina data i integritetspolicyn.

Ditt konto

När du loggar ut finns en kopia av ditt arbete kvar i den här webbläsaren. På en delad dator bör du rensa webbläsardata efteråt.

Vad vill du skapa?

Designer

Sociala medier

Dokument

Studier

Redigera

Visa alla 282 verktyg