TOOLTIKI Lovable tool, really free

Pulling the addresses out of a wall of text

The grammar for an email address permits quoted local parts, embedded comments and constructs almost nobody has ever used. A pattern implementing it faithfully runs to several thousand characters, is unreadable, and still cannot tell you whether the mailbox exists.

Extraction is a different job from validation, and it is the easier one. Pulling the addresses out of a page of text needs a pattern that matches what people actually write, and the only test of whether an address works is sending to it.

What does a practical pattern miss?

Very little that matters, and it is worth knowing which corners get cut.

Form Matched by a practical pattern
[email protected] yes
[email protected] yes
[email protected] yes
"odd name"@example.com no
name@[192.0.2.1] no

The last two are legal and effectively extinct. Excluding them costs nothing in ordinary text and saves a pattern nobody can maintain.

The plus sign in the third row is worth recognising rather than stripping. Plus-addressing is a real routing feature at most large providers, so [email protected] is a different address for filtering and the same mailbox for delivery.

Why do extracted URLs pick up punctuation?

Because a full stop is a legal URL character and also the end of your sentence. In "details at https://example.com/page." there is no way to tell from the characters alone whether the final stop belongs to the path or to the prose.

The usual convention is to strip trailing punctuation, which is right almost always and wrong for a URL genuinely ending in one. Brackets are worse: a link with a closing parenthesis inside it sitting in a parenthetical aside is genuinely ambiguous, and both interpretations produce a broken link half the time.

The other gap is bare domains. Text that says "visit example.com" contains no scheme, so a pattern looking for http will miss it entirely — which is why an extractor usually offers to match bare domains and why doing so also matches file names ending in a country code.

Query strings and fragments are the third decision. Whether the tracking parameters on the end of a link count as part of the URL depends on why you are extracting: for a list of pages to visit they are noise, and for auditing where traffic came from they are the whole point.

Why is the domain not the last two parts?

Because of names like example.co.uk, where the last two labels are co.uk and belong to nobody. Taking the final two parts gives you a suffix rather than a site.

There is a maintained list of these suffixes — the Public Suffix List — precisely because the rule cannot be derived. It records that co.uk, com.au and hundreds of others are registry-controlled, so the registrable domain is one label further left.

This matters for cookies, for grouping analytics by site, and for deciding whether two links point at the same organisation. Cutting at the wrong boundary groups every UK business under one heading.

What makes phone numbers hard?

Missing context. The international standard, E.164, allows up to fifteen digits including a country code of one to three, and everything a person actually types — spaces, brackets, hyphens, a leading zero, a plus — is presentation rather than data.

A bare ten-digit number could be a US number, a UK number missing its country code, or an order reference. Without knowing which country the text came from, extraction is a guess, and it is why an extractor works best on text where the numbers were written with their country code.

The safe target is E.164 itself: plus sign, country code, subscriber number, no punctuation. It is unambiguous, it is what dialling systems accept, and converting to it is only possible once you know the country the number belongs to.

Which decimal separator is that?

The one the writer’s country uses, and the two are exactly reversed. Most of continental Europe writes 1.234,56 where the UK and US write 1,234.56 — same value, opposite roles for the two marks.

A number extractor reading 1.234 therefore has two defensible answers: one thousand two hundred and thirty-four, or one point two three four. On a mixed-source document neither convention is safe to assume, and the only reliable fix is knowing the source.

Percentages, currency symbols and scientific notation add their own decisions about whether the symbol is part of the number. Stripping them is usually right, and it quietly turns a rate into a bare figure, so the unit needs recording somewhere.

Questions people ask

Can extraction confirm an address is real? No. It confirms the text is shaped like an address. Only delivery confirms the rest.

Does it handle obfuscated addresses? Forms written "name at example dot com" do not match, by design — matching them would produce false positives across ordinary prose.

Are duplicates removed? Usually yes, since a page repeats the same address in a header and a footer. Check whether the count you want is unique addresses or occurrences.

Is any of this uploaded? No. The pattern runs against the text in the page, which for a document full of contact details is the point.

Point it at the text and take what it finds. Extract emails and extract URLs do the two common jobs, extract phone numbers and extract numbers handle the ambiguous ones, and extract domain from URL cuts at the right boundary rather than the last two labels.