Home › Text Tools › Extract Text Between Delimiters

Extract Text Between Delimiters

Paste text and get every substring that sits between a start and an end marker: parentheses, square or curly brackets, quotes, HTML tags, or any words or symbols you type. Matches are highlighted in your text, counted, and ready to copy as a list or CSV.

Last updated:

Delimiters

Tip: leave the start or end marker blank to match from the start of the line or to the end of the line.

0matches
0unique
0lines with matches

Matches in your text

Frequency

ValueCountShare
Advertisement
Advertisement

How to use the Extract Text Between Delimiters

  1. Paste your text or open a text file. An example is loaded to show how it works.
  2. Choose the delimiters: pick a preset such as parentheses, quotes or an HTML tag, or type your own start and end markers.
  3. Adjust the matching: include the delimiters, match nested brackets, ignore case, or keep matches on one line.
  4. Clean the list: trim spaces, drop empty and duplicate values, and sort.
  5. Copy or download the extracted values, or use the frequency table to count how often each one appears.

How matching works

The tool scans your text from left to right. Each time it finds the start marker, it takes the text up to the next end marker, records it as one match, and continues searching after that end marker. Matches never overlap, and every occurrence is found, not only the first one.

  • Nested brackets. With different start and end markers, such as ( and ), the tool can count depth so (express (overnight)) returns express (overnight). Without nesting, the first closing marker ends the match and you get express (overnight.
  • Same start and end. Quotes and backticks open and close with the same character, so they cannot nest: the 1st and 2nd quote form a pair, then the 3rd and 4th, and so on. An odd number of quotes leaves the last one unmatched.
  • Escaped delimiters. In code and JSON, \" means a literal quote. With escapes skipped, "Lee \"Chef\" Park" returns Lee \"Chef\" Park as one value.
  • Blank marker. A blank start means "from the beginning of the line", a blank end means "to the end of the line". This turns the tool into a "text before X" or "text after X" extractor.

Examples

GoalStartEndInputResult
Text in parentheses()Paris (France), Rome (Italy)France, Italy
Template variables{{}}Hi {{name}}, your code is {{code}}name, code
Quoted phrases""She said "yes" and "thanks"yes, thanks
Log levels[][INFO] started [WARN] slowINFO, WARN
Value after a labelTotal: (blank)Total: $42.10$42.10
Text before a separator(blank) - Main Street - Building 4Main Street
Table cellstag td<td class="x">12</td><td>15</td>12, 15

Tips

  • Markers are matched literally, so characters such as ., * or ? need no escaping. For patterns (for example "any digit"), use the regex tester instead.
  • Turn off Allow matches across lines when processing logs or CSV rows, so a missing closing marker on one line does not swallow the following lines.
  • Tick Include delimiters when you want to delete or replace the found pieces later with find and replace.
  • Use Remove duplicates and Sort A–Z to turn a long document into a clean list of distinct values, or read the frequency table to see which value appears most.

Frequently asked questions

How do I extract text between two strings?

Choose Custom in the Delimiters list and type the start string and the end string, for example ID: and a semicolon. The tool finds each start marker, takes everything up to the next end marker after it, and lists each piece. Markers can be single characters, words or longer strings, and every occurrence in the text is extracted, not just the first.

What happens with nested brackets like (a (b) c)?

With Match nested brackets on (the default), the tool counts opening and closing markers, so the outermost pair is matched and (a (b) c) gives "a (b) c". Turn it off to stop at the nearest closing marker instead, which gives "a (b". Nesting only applies when the start and end markers are different, and in tag mode it pairs nested tags of the same name, such as a div inside a div.

Can I extract text between HTML tags?

Yes. Choose the HTML/XML tag preset and type the tag name, such as td, h2 or a. Opening tags with attributes, like <a href="…" class="x">, are matched, the text up to the matching closing tag is extracted, and you can tick Strip inner tags to get plain text. For complex, badly formed HTML, a real parser is more reliable than pattern matching.

How do I get the text before or after a word on each line?

Leave one marker blank. With the start blank, each match runs from the beginning of the line to the end marker; with the end blank, it runs from the start marker to the end of the line. For example start "Total:" with a blank end extracts everything after Total: on every line.

Does it handle escaped quotes?

With Skip escaped delimiters on, a delimiter preceded by a backslash, such as \" inside a JSON string, is treated as part of the text rather than the end of the match. Doubled quotes used in CSV files ("") are not treated as escapes.

Can I count how many times each value appears?

Yes. The frequency table under the results lists every distinct value with its count and its share of all matches, sorted from most to least common, and it has its own Download counts CSV button. The match count and the number of unique values are also shown at the top of the results.

Is my text uploaded anywhere?

No. The extraction runs entirely in your browser with JavaScript. Nothing you paste or open is sent to a server, so it is safe for logs, code and private documents.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Extract Numbers from TextPull every number out of text: decimals, negatives and percentages, with sum, average and CSV.URL ExtractorExtract every link from text or HTML, remove duplicates, filter by domain or protocol.Find and Replace TextFind and replace words or regex patterns in any text, with match highlighting and undo.Email ExtractorPull every unique email address out of text or files, sort, filter by domain and export CSV.Text to CSV ConverterTurn space-aligned, fixed-width, pipe or tab separated text into clean CSV with a live preview.Online Word ProcessorFree browser word processor with headings, lists, tables and images. Autosaves; export DOCX or PDF.Remove Line BreaksStrip line breaks and extra spaces, keep paragraphs if you want.Sort Lines AlphabeticallySort a list A-Z, Z-A, numerically, naturally or by length, or shuffle it.Case ConverterConvert text to UPPERCASE, lowercase, Title Case, camelCase and more.MLA Format GeneratorBuild an MLA 9 heading, title page layout and Works Cited entries.Lorem Ipsum GeneratorGenerate placeholder text as paragraphs, words or lists, with HTML.Text RepeaterRepeat any text or emoji up to 100,000 times with custom separators.Add Line NumbersNumber every line of your text with custom start, step, padding and separator, or remove numbers.Add Prefix and Suffix to LinesAdd text to the start and end of every line: quotes, commas, bullets or SQL lists.Comma SeparatorTurn a column of lines into a comma separated list and back, with any delimiter.Text to Handwriting ConverterTurn typed text into realistic handwriting on notebook paper and save it as PNG or PDF.Japanese Kana ConverterConvert romaji to hiragana or katakana, kana to romaji, and hiragana to katakana instantly.Pinyin Tone ConverterTurn pinyin tone numbers (ni3 hao3) into tone marks (nǐ hǎo), or tone marks back into numbers.Remove Duplicate LinesDelete duplicate lines from any list, ignoring case or spaces, keep first or last, and sort.Remove Extra SpacesClean up double spaces, tabs, blank lines, non-breaking and invisible spaces in one click.Random Word GeneratorGenerate random English words by type, length, first letter and syllables, then copy them.List RandomizerShuffle a list into random order, pick random items or split it into fair teams.Strip HTML TagsRemove HTML tags and get clean plain text with line breaks and decoded entities.Online NotepadPrivate notepad that autosaves notes in your browser, with find, word count and .txt download.Remove PunctuationStrip all or only selected punctuation from text, with smart options for apostrophes and numbers.Text SplitterSplit long text into chunks by characters, words, lines or a delimiter, with numbering and copy.Remove AccentsStrip accents and diacritics from text (é→e, ñ→n, ß→ss, ø→o) instantly, live as you type.Sort NumbersPull numbers out of any text and sort them ascending or descending, with sum, average and median.Thread SplitterSplit long text into numbered X, Threads, Bluesky or Mastodon posts at sentence boundaries.Duplicate Word FinderFind repeated words in your text: doubled words like "the the" and overused words, highlighted.Alternating Caps GeneratorTurn text into aLtErNaTiNg caps, random caps or alternating words, then copy it.Random Paragraph GeneratorGenerate readable random English paragraphs by topic and length for writing and design.Random Sentence GeneratorGenerate random grammatical sentences: simple, compound, complex and questions.Markdown to Plain TextStrip Markdown syntax and keep clean plain text with lists, line breaks and link URLs.SRT to TextTurn SRT or VTT subtitles into a clean transcript with paragraphs, with or without timestamps.Transcript CleanerRemove timestamps, speaker labels and filler words like um and uh, and fix broken line breaks.Extract Phone NumbersFind phone numbers in any text, normalize them to E.164, remove duplicates and export CSV.Paragraph to Bullet Points ConverterSplit paragraphs into bullet points by sentence or clause, with your choice of bullet style.Text to Word ConverterTurn text or a .txt file into a Word .docx with your font, margins and page size.WhatsApp Text FormatterFormat WhatsApp messages with bold, italic, strikethrough, monospace, lists and quotes, then copy.Word CombinerBlend two or more words into portmanteaus, compound and clipped names for brands and wordplay.Word to HTML ConverterConvert Word .docx files or pasted rich text into clean, semantic HTML with live preview.Word Wrap ToolWrap text at any column width with hard line breaks, indents and prefixes, or unwrap it again.Daily Affirmation GeneratorGet random positive affirmations by theme; save favorites, copy them or make an image card.Business Plan GeneratorFill in a guided form and get a formatted business plan with financial tables, as Word or PDF.Keyword Match Type ConverterTurn a keyword list into broad, "phrase", [exact] and negative match types for PPC ads.Discord Text FormatterFormat Discord messages with bold, spoilers, headers, quotes, lists and code blocks, with live preview.DNA Reverse ComplementGet the reverse, complement or reverse complement of DNA/RNA, FASTA and IUPAC codes supported.Filter Lines Containing TextKeep or remove lines that contain words or match a pattern, with match counts and regex.Focus Reading ConverterBold the first letters of every word for faster, focused reading. Copy as rich text or HTML.Memo GeneratorWrite a business memo in standard To/From/Date/Subject format, then print, copy or save as .docx.PDF Text CleanerFix text copied from a PDF: join broken lines, undo hyphen splits, drop page numbers and headers.Pros and Cons List MakerWeigh a decision with a weighted pros and cons list, a score, a verdict and easy export.Remove Numbers from TextStrip all numbers and digits from text, keep MP3-style words or ordinals, and tidy the spaces.Return Policy GeneratorCreate a return and refund policy for your store as text or HTML, with a refund example.Screenplay FormatterType a script in plain text (Fountain) and get a properly formatted screenplay, page count and PDF.Word ChangerSwap words for synonyms in your text, then click any word to cycle through alternatives.Words That End WithFind English words ending in any letters or suffix, filtered by length and sorted by score.Annotated Bibliography GeneratorBuild an APA or MLA annotated bibliography with hanging indents and download it as DOCX.EPUB to Text ConverterExtract plain text from EPUB e-books, pick chapters, count words and download a TXT file.Extract Dates from TextFind every date in text, in any common format, and convert them all to one format you choose.Recipe Shopping List GeneratorPaste several recipes and get one combined grocery list with merged amounts, by store section.One Word Per LineSplit any text into a list with one word per line; strip punctuation, dedupe, lowercase and sort.Recipe FormatterPaste a messy recipe and get clean ingredients, numbered steps, scaling and a printable card.Remove Words from TextDelete a list of words or phrases from any text and see how many times each one was removed.Reverse Line OrderFlip the order of lines, list items or paragraphs so the last becomes first.Pairwise Sequence Alignment ToolAlign two DNA or protein sequences, global (Needleman-Wunsch) or local (Smith-Waterman), with identity %.Sort Lines by LengthSort lines from shortest to longest or the reverse, with ties sorted A-Z and lengths shown.
See all 96 Text Cleaning & Formatting →