Premium tools, free for everyone. Most run right in your browser.

OpenMultiURL

Links and URLs

How to Extract Links From Text and Keep URLs Intact

Coloured card showing the title How to Extract Links From Text and Keep URLs Intact

A copied email can give you the words “Read the report” without giving you the report’s address. That’s the first problem I look for when I extract links from text: does the copied text actually contain the destinations? I build OpenMultiURL and test my tools on a budget Android phone and a laptop, so I care about a workflow you can check without juggling tabs. My approach is to collect the addresses, preserve their details, then review them before opening anything.

I start by checking the source, rather than choosing a tool immediately. If I can see complete addresses in the text, a text-pattern search can collect them. If I can only see linked words, I need the destinations behind those words. That distinction saves more effort than trying several extractors against text that never contained the addresses.

I choose my extraction method according to what the source actually contains.
What you haveMethod I would useMain thing I check
A short note with visible URLsFind and copy the complete addressesSentence punctuation at each boundary
A long plain-text passageAn editor search or URL-pattern extractorMissing addresses and extra characters
HTML with linked wordsAn HTML parser that reads anchor href valuesRelative destinations and non-web schemes
An email with linked labelsCopy each link destination or inspect its HTMLWhether ordinary copying preserved the URL
An existing URL listCleanup and exact deduplicationKeeping original values and order

I separate collecting from opening

My quick workflow is collect, compare, clean, then open. I keep the source beside the extracted list until I’m satisfied nothing important disappeared. I also decide whether I need every occurrence or only unique addresses. Repeated links can matter if I’m checking where they appeared, even though I don’t need to open the same address repeatedly.

How do I extract a list and use Open Multiple URLs?

I use Open Multiple URLs at the opening stage, not as a substitute for extracting hidden destinations or checking safety. Keeping that boundary clear matters. A list that is ready to paste into an opener should already contain the addresses I intend to visit, rather than a mixture of instructions, email text and unreviewed links.

  1. I save an untouched copy of the source text before changing anything.
  2. I use my editor’s Find command to locate visible URL starts such as https:// and http://.
    • For a short passage, I copy each full address into a separate list.
    • For repeated work, I use a regex-capable editor or a suitable extractor and review its matches.
  3. I put one complete URL on each line, keeping its query string and fragment.
  4. I compare the list with the source, repair extraction mistakes and remove only the duplicates I don’t need.
  5. I open Open Multiple URLs and paste the reviewed list into its URL input.
  6. I check the pasted addresses before using the opening control, and start with a small set I can review comfortably.

I don’t assume that a page opening successfully proves the extraction was correct. A missing fragment might still open the page, but leave me away from the section I wanted. A missing query value might lead somewhere different. My check is whether the copied address matches the intended destination, not merely whether a tab appears.

Tip from me: I keep my original list in a separate note while opening pages. If I need to restart, I don’t have to rebuild the list from browser tabs.

I check whether the destination is visible

A visible URL and a clickable label are different kinds of source material. If a message displays a full address, that address can survive copying as plain text. If the message displays “Open the file,” the destination may exist only in the link data. I can’t recover that missing destination by searching the words more carefully.

I check these common formats before deciding that an extractor missed something.
Source formatWhere I look for the destinationLikely problem
Plain textThe visible address itselfPunctuation can join the match
Rich-text emailThe linked words’ stored destinationPlain-text copying may omit it
HTMLThe anchor element’s href valueA text search may miss relative paths
MarkdownThe destination associated with the labelA broad match may include a closing delimiter
Copied document textVisible addresses or preserved link dataThe copying method may discard destinations

For an email, I compare a visible address with its actual link destination when both are available. For a copied web page, I check whether the pasted version still contains URLs before running extraction. And for a text file, I open it as text first. I don’t assume an online tool accepts file uploads just because it accepts pasted text.

For HTML, I want an HTML-aware method that reads anchor destinations. The MDN anchor element reference explains that the href attribute specifies the destination. Searching only for visible web addresses is a different task, and it can miss the links attached to ordinary words.

I keep the base address with relative links

A destination such as /help/ is incomplete outside its original context. I need the page’s base URL to resolve it. I don’t add a domain by guesswork, especially when the HTML came from an export or forwarded message. Relative paths need a base, as MDN’s explanation of creating links describes.

  • I collect anchor href values rather than every address-looking string in the HTML.
  • I resolve relative destinations against the correct base URL.
  • I decide whether to keep mailto: and tel: destinations separately from web links.
  • I preserve fragment destinations when the task includes links to sections of a page.

That last filtering decision matters. An href value isn’t automatically an HTTP or HTTPS page. If I’m preparing a browser reading list, I separate other schemes instead of treating them as extraction errors. For a full link inventory, I may want to retain them, with their types clearly recorded.

How can I extract URLs from a string with regex?

I use a regular expression when I need a repeatable first pass through plain text. A regex is a search pattern, not a browser and not an HTML parser. In an editor with regular-expression search enabled, the simple pattern https?://[^\s]+ looks for HTTP or HTTPS followed by non-whitespace characters. I treat each match as a candidate to inspect.

I expect a simple pattern to miss context

That pattern won’t collect a bare domain such as example.com or a relative path such as /help/. It also doesn’t know whether a final parenthesis belongs to a URL or the surrounding sentence. If I apply it to HTML, it may collect unrelated address strings while missing relative anchor destinations. I choose it for visible web addresses in text, not every possible link format.

I also avoid describing any short pattern as a complete URL validator. RFC 3986 describes URI components and includes a parsing expression in Appendix B. Parsing components still doesn’t establish that an address exists or is safe. My search finds likely strings; my review decides what belongs in the working list.

Tip from me: I try a search pattern on a small, readable sample before applying it to the whole passage. I check both the matches and the links it failed to match.

How do I clean extracted URLs without changing them?

I clean boundaries before changing URL content. A comma copied from a sentence may need removing. A comma inside an address may belong there. The same caution applies to parentheses. I compare questionable endings with the source instead of applying a rule that deletes every final punctuation mark.

  • I remove surrounding quotation marks or sentence punctuation only when the source makes the boundary clear.
  • I repair accidental line wrapping only after checking how the original address was written.
  • I retain query strings and fragments unless I have a specific reason to create a changed copy.
  • I remove exact duplicates first, keeping a record of the original list.
  • I review near-matches separately rather than assuming similar-looking URLs are interchangeable.

I preserve parameters before simplifying

Query values can be part of the intended destination. A fragment can identify a section. Percent-encoded reserved characters can also affect interpretation if decoded. So I don’t automatically decode URLs, lowercase whole addresses or remove everything after a question mark. Preserving the original is my default, especially for campaign links and addresses containing unfamiliar characters.

For repeated addresses, I use URL Deduplicator as a separate cleanup step and review its current options before applying them. If I deliberately need to remove tracking details, I use Tracking Parameter Remover on a copy. I don’t mix that decision into extraction, because collecting a link and changing it are different jobs.

The mistake I’m most careful about is accepting a tidy list as proof of a complete list. Clean formatting can hide missing destinations, altered query values or lost source context. I compare the output with the original before sorting or deleting anything, while the relationship between the text and its links is still easy to follow.

  1. I don’t strip all closing brackets. Some can belong to the URL rather than the surrounding text.
  2. I don’t assume linked labels contain recoverable addresses after plain-text copying.
  3. I don’t remove queries or fragments just to make addresses shorter.
  4. I don’t sort immediately when first-seen order helps me compare the list with the source.
  5. I don’t combine similar URLs until I understand why they differ.
  6. I don’t open unfamiliar extracted addresses automatically.

If you only need links from a particular website, I would extract complete addresses first, then inspect their hosts. URL Parser helps me examine the parts of an address, while Domain Extractor is useful when domains are the intended output. I keep full URLs alongside that domain list, because a domain alone loses page-level detail.

I separate finding a URL from checking its structure, reaching its destination and deciding whether to trust it. A pattern match handles only the first job. Even a reachable page may be the wrong destination. I don’t describe extracted addresses as verified links unless I’ve actually done the relevant checks.

I review the address before the page

I inspect unfamiliar domains and compare important addresses against their source. For structural checking, I can use URL Validator, without treating that result as a safety verdict. If I need to examine forwarding, I use Redirect Checker as a separate step. Neither step replaces deciding whether I intended to visit that destination.

My saved list keeps the extracted address separate from any later destination I record. That helps me avoid replacing evidence from the source with a changed address. And I don’t use opening success as my only test: a working destination still needs to match the purpose of the original link.

Is it safe to paste private text into an extractor?

I check the specific tool’s current privacy information before pasting private material. I don’t assume that every online extractor works entirely in the browser, avoids retention or handles uploaded files the same way. Those are product-specific details. A useful extraction feature isn’t, by itself, a reason to paste a confidential email into it.

I also treat URLs themselves as potentially sensitive. Removing the surrounding message doesn’t necessarily remove private information from its links. If I’m unsure whether an address contains confidential details, I keep the work local rather than making a guess about an online service’s handling of it.

  • I check whether the tool supports pasted text, uploaded files or both.
  • I read its current input limits rather than borrowing a limit from another product.
  • I keep a source copy so that dividing text into batches doesn’t lose context.
  • I check the available output format before expecting a spreadsheet download.

For sensitive text, my preference is a local editor or an approved local workflow. For non-sensitive material, an online tool may be convenient, but I still review the result. Privacy, file support and extraction accuracy are separate questions, and I want an answer to each before relying on the workflow.

Questions people ask

How do I extract links from text?

I first check whether the text contains visible addresses or only linked words. For visible URLs, I use an editor search or a text-pattern extractor, then place each complete address on its own line. I compare the output with the source, clean boundaries carefully and review duplicates before opening anything.

How do I extract links from HTML?

I use an HTML-aware method that collects anchor href values. I resolve relative destinations against the correct base URL and decide whether to retain mailto:, tel: and fragment-only destinations. I don’t rely on searching for HTTP prefixes alone, because that can miss valid relative links.

Can I extract links from an email or copied web page?

I can extract visible addresses from copied text, but linked labels need more care. Plain-text copying may discard their destinations. If I see only words such as “Read more,” I return to the original email or page and copy the destination, or use a method that preserves its link data.

How can I remove duplicate links from a list?

I begin with exact duplicate URLs and keep an untouched original list. I preserve first-seen order when it helps with source comparison. I review near-duplicates separately, because different queries, fragments or other URL details may be meaningful. I don’t assume similar-looking addresses represent the same intended destination.

Why does a URL extractor include a period or bracket at the end?

I usually find that the extractor matched non-space characters without understanding the surrounding sentence. That can pull in a final period or bracket. But punctuation can also belong inside a URL, so I compare the match with its source instead of deleting every closing character automatically.

Can an extractor tell whether a link works?

I don’t treat extraction as a working-link test. A text matcher finds candidate addresses, while checking structure and reaching destinations are separate tasks. I also keep safety review separate: a matched address, or even a page that opens, doesn’t by itself establish that I should trust the destination.

What to do next

I’d start with an untouched copy of your source and check whether its destinations are actually present. Extract visible addresses with a text search, or collect href values when you have HTML. Then keep one complete URL per line, compare the list with the source and remove only the characters or duplicates you understand. Preserve queries and fragments unless changing them is your deliberate next task. Once you’ve reviewed the addresses, paste your list into Open Multiple URLs and open a manageable set. I’d rather spend a moment checking the list than work from a neat-looking list that silently changed the links.

Sources I checked

Tools from this guide

Keep reading