← Back to Blog

Regex Capture Groups: Named, Non-Capturing & Backreferences

Complete guide to regex capture groups: basic, named, non-capturing, backreferences, and practical extraction examples.

Types of Groups

// Basic capture group\n(\d{4})-(\d{2})-(\d{2})   // $1=year, $2=month, $3=day\n\n// Named capture group\n(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})\n\n// Non-capturing group (grouping without capture)\n(?:https?|ftp)://\n\n// Backreference (match same text again)\n(<([a-z]+)>).*</\2>   // matches paired HTML tags

Try It Free

Use our free online tool — 100% client-side, no data leaves your browser.

Open Regex Tester

Related Tools & Articles