Regex Tester

Results

Patrones Comunes

Email

\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b

Teléfono

(\+?34|0034|34)?[6|7|8|9][0-9]{8}

URL

https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)

IP Address

\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b

Fecha

\b\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}\b

Número

-?\d+(?:\.\d+)?

Regex fundamentals

Regular expressions describe text patterns. Understanding the building blocks helps you craft accurate expressions that are easy to debug.

Core syntax

  • . matches any character except newline, \d digits, \w word characters, \s whitespace.
  • Character classes [abc] match specific sets; use [^abc] to negate.
  • Anchors ^ and $ ensure matches start or end at specific positions.
  • Quantifiers (*, +, ?, {m,n}) control repetition.

Flags

  • g finds all matches; i ignores case.
  • m treats input as multiline, making ^/$ match line boundaries.
  • s lets . match newlines; u enables Unicode support.
  • y (sticky) attempts matches starting at the last index in JavaScript engines.

Best practices

Thoughtful patterns are easier to maintain and less likely to cause performance surprises.

Document intent

Use verbose mode ((?x)) or inline comments to explain non-obvious groups and avoid future mistakes.

Avoid catastrophic backtracking

Limit nested wildcards, prefer explicit quantifiers, and consider atomic/possessive groups to guard against exponential runtime.

Validate beyond regex

Combine pattern checks with schema or business rules—especially for emails, URLs, and structured identifiers.

Quick question

Are you testing patterns against short samples or large text streams?

JavaScript

const pattern = /\b\d{3}-\d{2}-\d{4}\b/g;
const matches = 'Visit 123-45-6789 or 987-65-4321'.match(pattern) ?? [];
console.log(matches);

Python

import re

pattern = re.compile(r'\b\d{3}-\d{2}-\d{4}\b')
text = 'Visit 123-45-6789 or 987-65-4321'
print(pattern.findall(text))

Regex tester FAQ

What are common regex flags and what do they do?

Flags such as g, i, m, s, and u adjust matching behavior—use them to find multiple results, ignore case, work with multiline input, or enable Unicode.

How can I avoid catastrophic backtracking?

Keep quantifiers specific, avoid nested wildcards, and consider atomic or possessive groups to prevent exponential backtracking on crafted inputs.

Does this regex tester send my sample text to a server?

No. Testing happens entirely in your browser so log snippets, payloads, and secrets remain private.

When should I use lookaheads or lookbehinds?

Use lookarounds to assert surrounding context without consuming characters—helpful for password policies, boundary checks, or format validation.

What is the best way to validate email addresses with regex?

Simple regexes cover common cases, but no pattern fully implements RFC 5322. Pair regex with domain validation or verification emails for accuracy.