Regex for Matching a Markdown Link

Captures the link text and URL from Markdown link syntax.

Published October 12, 2026

Captures the link text and URL from Markdown link syntax.

Key points

  • The first capture group grabs the link text, the second grabs the URL
  • For parsing full Markdown documents reliably, a dedicated Markdown parser handles far more edge cases than a single regex

Example

\[([^\]]+)\]\(([^)]+)\)
More General articles