Home/Blog/How to Extract File Names from Text

How to Extract File Names from Text

Pull all file names with common extensions from documents, chat logs, directory listings, and project docs.

2026-05-09Extract Data

Finding all the file names mentioned in a document, email thread, or chat log is tedious to do manually. The Extract File Names tool scans any text and pulls out every file name with a recognized extension.

Supported File Extensions

The tool detects files with these extensions: .pdf, .doc, .docx, .xls, .xlsx, .csv, .json, .txt, .md, .png, .jpg, .jpeg, .gif, and .webp. This covers the most common document, spreadsheet, data, and image formats.

Common Use Cases

Project inventory — paste a README or project spec to extract every file referenced. Chat log cleanup — paste a Slack or Teams export to find all shared files. Directory listings — paste ls or dir output to extract just the file names without metadata. Email threads — find all attachments and file references mentioned in a conversation.

How It Works

Paste your text into the Extract File Names tool and click Run. The tool uses pattern matching to find words ending with recognized file extensions and returns a deduplicated list. Each file name appears once, even if mentioned multiple times.

Tips for Better Results

If your text has file paths (like /home/user/docs/report.pdf), the tool extracts just the file name. For files with unusual extensions not in the supported list, the tool won't detect them — in that case, try the Extract URLs tool if the files are referenced as links.

Try it now — paste your text below

Everything runs locally in your browser. No data is stored.

Extract File Names

Find and extract file names with common extensions like .pdf, .docx, .xlsx, .csv, .json, .png, and more.

Example

Input

Please review report.pdf and update data.xlsx. See photo.jpg.

Output

report.pdf
data.xlsx
photo.jpg

How Extract File Names Works

Find and extract file names with common extensions like .pdf, .docx, .xlsx, .csv, .json, .png, and more.

This tool runs entirely in your browser — no data is sent to any server. Paste your text, click Run, and get your result instantly. You can also chain this tool with others using the pipeline feature: run Extract File Names, then continue with a related tool to build a multi-step text workflow.

TextRefinery is a free, open-source text processing toolkit. Learn more about regular expressions and text processing on the web.

TextRefinery — Browser-first text transformation tools. All processing happens locally in your browser.