Extract text between two characters

Pulls out everything between a start and end marker — every occurrence, not just the first.

Type the marker that starts the part you want and the one that ends it, then press the button. Every match in the text is returned on its own line — not just the first one, which is where most quick solutions stop.

Markers are literal, which is the point

Whatever you type is matched exactly. You do not need to escape anything: brackets, dots, asterisks, quotes and slashes all work as themselves. This matters because the alternative — writing a regular expression — means remembering that ( has to be written \(, and that mistake produces either an error or, worse, silently wrong output.

Matching is non-greedy, so with markers ( and ) the text (a) and (b) gives you a and b on separate lines, not the single result a) and (b that a greedy match returns. Greedy matching is the number one reason people's extraction attempts come back with one enormous useless result.

Common marker pairs

Remove between — the inverse

The second button deletes everything between the markers, including the markers themselves. This is how you strip bracketed asides from a transcript, remove HTML comments, delete timestamps in square brackets from a chat log, or clear the contents of tags while keeping the surrounding text.

What you get and what you should check

Results come back one per line in the order they appear. "Trim each result" is on by default, since a marker followed by a space usually means the space is not part of what you wanted. "Remove duplicates" is useful when extracting things like link targets, where the same URL appears many times.

If nothing matches, the tool says so rather than silently returning your original text — a small thing that saves you from copying an unchanged block and wondering later why the data looks wrong.

One real limitation: nesting. With markers ( and ) the text (a (b) c) gives you a (b, because the first closing bracket ends the match. Genuinely nested structures need a parser, not a pair of markers — for JSON or XML, use a tool built for that format.

Doing it without this tool

Excel: =MID(A1, FIND("(",A1)+1, FIND(")",A1)-FIND("(",A1)-1). That finds the first occurrence only; getting all of them needs a nest of helper columns or VBA, which is why every Excel forum thread on this question is forty replies long.

Notepad++: Find in regex mode with \((.*?)\) and Mark → "Copy marked text", which is a sequence most people have to look up each time.

Command line: grep -oP '(?<=\().*?(?=\))' file.txt works with GNU grep and needs Perl regex support, which macOS grep does not have by default.

Google Sheets: =REGEXEXTRACT(A1, "\((.*?)\)") — again, first match only.

Try:
0Words
0Characters
0No spaces
0Sentences
0Paragraphs
0Lines
0Pages
0Reading
0Speaking

Runs entirely in your browser. Your text is never uploaded — open DevTools, Network tab, and you will see zero requests while you use this tool.

How to use it

  1. Paste your text into the box.
  2. Type the start marker and the end marker exactly as they appear — no escaping needed.
  3. Press "Extract between" to pull out every match, one per line.
  4. Press "Remove between" instead if you want to delete those sections rather than keep them.

Related tools

Remove HTML tagsTurns HTML into plain readable text, dropping scripts, styles and markup.Extract URLsPulls every http and https link out of text or HTML and removes duplicates.Extract emailsPulls every email address out of a block of text and removes duplicates.Extract numbersPulls every number out of a block of text, and can total them for you.Username generatorReadable names built from real words. No xX_ padding, no forced digits.Cursive textHandwriting-style letters you can paste anywhere plain text goes.Name pickerPaste a list, pick a winner. No account, no cloud, no limit.

See all text tools →

Frequently asked questions

Does it find every occurrence or just the first?

Every occurrence, each on its own line, in the order they appear. Spreadsheet formulas and most one-line regex answers only return the first match, which is the usual reason people end up here.

Do I need to escape brackets or special characters?

No. Markers are matched literally, so you can type ( or [ or " or * directly without escaping. That avoids the most common cause of a broken pattern.

What happens with nested brackets?

The first closing marker ends the match, so (a (b) c) returns "a (b". Truly nested structures need a real parser for that format rather than a pair of markers.

Can I delete the text between the markers instead?

Yes, press "Remove between". It deletes the matched sections including the markers themselves, which is how you strip bracketed asides or HTML comments.

What if nothing matches?

You get a message saying nothing was found between your markers, rather than the original text returned unchanged, so you never copy stale output by mistake.