Aarunya AppsAarunya Apps

Markdown LinkRegex — Pattern, Examples & Code

\[([^\[\]]+)\]\(([^()]+)\)/g

What it matches / doesn't match

Matches ✅Does not match ❌
[Click here](https://example.com)[No URL]
[Docs](/docs/guide)(https://example.com)
[Email](mailto:hi@example.com)[text] (space before paren)

How it works

Matches standard Markdown inline link syntax: text inside square brackets followed immediately by a URL inside parentheses. The pattern captures both the link label and the URL as separate groups. It does not match reference-style links ([text][ref]) or image links (![alt][url]).

Code Usage

JavaScript

const regex = /\[([^\[\]]+)\]\(([^()]+)\)/g;
const m = "[Click](https://x.com)".matchAll(regex);
for (const [, text, url] of m) console.log(text, url);

Python

import re
pattern = re.compile(r'\[([^\[\]]+)\]\(([^()]+)\)')
pattern.findall("[Click](https://x.com)")  # [('Click', 'https://x.com')]

Go

import "regexp"
r := regexp.MustCompile(`\[([^\[\]]+)\]\(([^()]+)\)`)
r.FindStringSubmatch("[Click](https://x.com)") // ["[Click](https://x.com)", "Click", "https://x.com"]

Need a custom regex for a different use case?

Generate a custom regex with AI →

FAQ

What does the Markdown Link regex pattern match?

Matches standard Markdown inline link syntax: text inside square brackets followed immediately by a URL inside parentheses. The pattern captures both the link label and the URL as separate groups. It does not match reference-style links ([text][ref]) or image links (![alt][url]).

How do I use the Markdown Link regex in JavaScript?

const regex = /\[([^\[\]]+)\]\(([^()]+)\)/g; const m = "[Click](https://x.com)".matchAll(regex); for (const [, text, url] of m) console.log(text, url);

Can I use the Markdown Link regex in Python?

Yes. import re pattern = re.compile(r'\[([^\[\]]+)\]\(([^()]+)\)') pattern.findall("[Click](https://x.com)") # [('Click', 'https://x.com')]