Regex to Extract Markdown Links

All patterns
Extraction36 chars · /g

Regex to Extract Markdown Links

This pattern helps pull markdown links into audits, migrations, and content QA workflows.

The expression

/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g

How to read it

\s matches any whitespace, including tabs and newlines.

A negated class [^ … ] matches anything except the listed characters.

gglobal — keep going after the first match instead of stopping

Find matches in your own text

no input
Try:

This expression is unanchored, so it finds every occurrence anywhere in the text. Highlighted runs are what a replace call would rewrite.

Examples, checked in your browser

4/4 verified

[Tinapps](https://tinapps.com)

Matches.

Read [docs](https://example.com/docs)

Matches.

Just plain text

No match — this is the kind of input the pattern rejects.

[broken](notaurl)

No match — this is the kind of input the pattern rejects.

Use it in code

3 languages
JavaScript
const regex = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g;
regex.test(input);
Python
import re
pattern = re.compile(r"\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)")
bool(pattern.search(input))
Go
re := regexp.MustCompile("\\[([^\\]]+)\\]\\((https?:\\/\\/[^\\s)]+)\\)")
matched := re.MatchString(input)

Other extraction patterns

4
GroupExtraction
Flags/g
Examples4
SafetyOK