Regex Helper – Extract Emails, Phones & URLs from Text avatar

Regex Helper – Extract Emails, Phones & URLs from Text

Pricing

from $0.01 / actor invocation

Go to Apify Store
Regex Helper – Extract Emails, Phones & URLs from Text

Regex Helper – Extract Emails, Phones & URLs from Text

Run named regular expressions over a list of strings or an upstream Actor's dataset. Each row holds the original text, every match with its character offsets and capture groups, and a match count. Built-in email, phone, LinkedIn and URL patterns for contact extraction. Python re syntax.

Pricing

from $0.01 / actor invocation

Rating

0.0

(0)

Developer

R.L.

R.L.

Maintained by Community

Actor stats

0

Bookmarked

4

Total users

2

Monthly active users

4 days ago

Last modified

Share

Regex Helper applies a list of named regular expressions to a list of free-form strings and returns structured, ready-to-use matches. It's a small building block for plugging regex-based extraction — contact info, IDs, URLs, SKUs, hashtags, anything — into a larger data-processing workflow on the Apify platform.

Because it runs as an Actor, you get an HTTP API, scheduling, and integrations (Make, Zapier, n8n, Google Drive, ...) for free — so you can chain it after a scraper that produces raw text and before whatever consumes the cleaned-up fields.

Built to be chained. Regex Helper has a dedicated pipeline mode: point it at another Actor's output dataset and it reads the text straight from there — no glue code, no manual export/import. Combined with sensible defaults, this lets you drop it into a two-step Apify pipeline (for example RAG Web Browser → Regex Helper) where an upstream run finishes, fires a webhook, and Regex Helper extracts contacts from every page it scraped.

What can this Actor extract?

  • Drop-in pipeline step — read input directly from any upstream Actor's dataset and post-process scraped text without writing a single line of glue code.
  • Reusable extraction step — define your patterns once and run them over thousands of strings.
  • No code required — paste strings and regexes into the input form, hit run, download results.
  • Structured output — every match comes with its value, position, and capture groups, grouped by the pattern name you chose.
  • Works out of the box — omit the patterns and Regex Helper falls back to a built-in contact-extraction set (email, phone, url, linkedin), so a chained run needs almost no configuration.

A typical use case is contact information extraction: chain it after a scraper, and get back a tidy record of emails, phones, and URLs for every page that was crawled.

How do I run it?

On my own list of strings

  1. Open the Input tab.
  2. Add the strings you want to process (one per line).
  3. Add your named regular expressions — each needs a name and a regex (Python re syntax), with optional flags.
  4. Click Start and download the results from the Output tab.

On another Actor's output (pipeline mode)

Instead of pasting strings, you can have Regex Helper read its input straight from another Actor's output dataset:

  1. Run any Actor that produces a dataset of text (a scraper, RAG Web Browser, an LLM Actor, etc.).
  2. Start Regex Helper with inputDatasetId set to that run's dataset ID. When set, it overrides the inline strings list.
  3. Set textField to the dataset field that holds the text to match against (defaults to markdown, the field RAG Web Browser produces).
  4. Leave patterns empty to use the built-in contact-extraction set, or supply your own.

The cleanest way to wire this up is a webhook / integration on the upstream Actor: on run success, start Regex Helper and map the upstream dataset into inputDatasetId. For example, in an upstream Actor's Integrations → Webhook configuration, set the payload so that:

{
"inputDatasetId": "{{resource.defaultDatasetId}}",
"textField": "markdown"
}

Now every time the upstream run finishes, Regex Helper automatically extracts matches from its output — a native, two-step Apify pipeline with no code in between. You can chain it the same way via the API, Apify CLI, scheduled tasks, or any of the supported integrations.

What input does it take?

All fields are optional, but you must supply text to process one way or another — either inline strings or an inputDatasetId (pipeline mode).

FieldTypeDescription
stringsarray of stringsThe free-form strings to process. Each one produces a single output record. Ignored when inputDatasetId is set.
inputDatasetIdstringPipeline mode. ID of an upstream dataset to read input strings from. When set, each item's textField is matched against the patterns, overriding strings. Map {{resource.defaultDatasetId}} from an upstream run to chain Actors.
textFieldstringWhen reading from inputDatasetId, the dataset item field whose value is matched. Defaults to markdown (the field produced by RAG Web Browser). Items without the field are skipped.
patternsarray of objectsThe named regexes to apply. Each item is { "name", "regex", "flags" }. If omitted, a default contact-extraction set (email, phone, url, linkedin) is used.
firstMatchOnlybooleanIf true, only the first match of each pattern per string is returned. Defaults to false (all matches).

Each entry in patterns accepts:

  • name (string, required) — used as the key under matches in the output. Must be unique.
  • regex (string, required) — a Python re pattern.
  • flags (string, optional) — any combination of i (ignore case), m (multiline), s (dotall), x (verbose), a (ASCII).

Which patterns are built in?

Leave patterns empty and these four are applied instead — the set is tuned for contact extraction, and the pattern name becomes the key under matches:

NameMatchesRegexFlags
emailEmail addresses[\w.+-]+@[\w-]+\.[\w.-]+i
phonePhone numbers, incl. spaces, dots, dashes and parentheses\+?\d[\d\s().-]{7,}\d—
linkedinLinkedIn profile and company URLshttps?://(?:[a-z]{2,3}\.)?linkedin\.com/[^\s)\]]+i
urlAny HTTP/HTTPS URLhttps?://[^\s)\]]+—

Example input

{
"strings": [
"John Doe, john.doe@example.com, +1 (415) 555-0132, https://example.com",
"Reach Jane at jane_smith@work.co.uk or call 020 7946 0958."
],
"patterns": [
{ "name": "email", "regex": "[\\w.+-]+@[\\w-]+\\.[\\w.-]+", "flags": "i" },
{ "name": "phone", "regex": "\\+?\\d[\\d\\s().-]{7,}\\d" },
{ "name": "url", "regex": "https?://[^\\s]+" }
],
"firstMatchOnly": false
}

Example input (pipeline mode)

Read text from an upstream run's dataset and apply the default contact-extraction patterns — no strings or patterns needed:

{
"inputDatasetId": "{{resource.defaultDatasetId}}",
"textField": "markdown"
}

What does each output row contain?

The Actor pushes one record per input string to the dataset. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

{
"index": 0,
"input": "John Doe, john.doe@example.com, +1 (415) 555-0132, https://example.com",
"matchCount": 3,
"matches": {
"email": [
{ "value": "john.doe@example.com", "start": 10, "end": 30, "groups": [], "namedGroups": {} }
],
"phone": [
{ "value": "+1 (415) 555-0132", "start": 32, "end": 49, "groups": [], "namedGroups": {} }
],
"url": [
{ "value": "https://example.com", "start": 51, "end": 70, "groups": [], "namedGroups": {} }
]
}
}

Data table

FieldDescription
indexZero-based position of the string in the input list.
inputThe original input string.
matchCountTotal number of matches found across all patterns for this string.
matchesObject keyed by pattern name; each value is a list of match objects.
matches.<name>[].valueThe matched text (full match, group 0).
matches.<name>[].start / endCharacter offsets of the match within the input string.
matches.<name>[].groupsNumbered capture groups, if the pattern defines any.
matches.<name>[].namedGroupsNamed capture groups, e.g. (?P<area>\d{3}).

How much does a run cost?

The Actor charge is a single flat fee per run (see the Pricing tab), billed once after the input has been validated — it does not grow with the number of strings you pass, so one run over 10,000 strings costs the same as one run over 10. On top of that you pay Apify platform usage, which is small here: this is plain in-memory text processing with no proxies and no browsers, and the Actor runs in 128–256 MB of RAM.

A run with malformed input (an invalid regex, a duplicate pattern name, no text to process) fails before the charge, so you are not billed for it.

Tips

  • Enable firstMatchOnly when you only expect one hit per pattern (e.g. a single primary email) to keep output compact.
  • Remember to escape backslashes when writing regexes in JSON (\\d, \\w, ...).
  • In pipeline mode, double-check that textField matches the field your upstream Actor actually writes (e.g. text, markdown, html); items lacking that field are skipped and logged.

FAQ

Do I need an account or an API key? An Apify account, yes — that is what runs the Actor. No third-party API key, login or proxy: the Actor only reads the text you give it and never makes an outbound request to the sites the text came from.

Which regex dialect is used? Python's built-in re module. Anything re.compile() accepts works here, including lookarounds and named groups; PCRE-only constructs such as recursion do not.

What does one output row contain? One input string. The row carries the original text in input, its zero-based index, a matchCount, and a matches object keyed by your pattern names — each holding a list of matches with value, start, end, groups and namedGroups.

What is a named capture group? A sub-part of a pattern you label inline, written (?P<area>\d{3}). Every label you use turns up as a key in that match's namedGroups, so you can pull the area code out of a phone number instead of post-processing the whole match. Unlabelled groups land in groups, in order.

What happens if a string has no matches? You still get a record for it, with empty match lists and matchCount: 0. Rows are never dropped, so the output lines up one-to-one with your input.

Can I schedule it or run it from my own code? Yes. Like any Actor it has an HTTP API, a CLI, schedules and integrations (Make, Zapier, n8n, Google Drive, ...).

How do I chain this after my scraper? Use pipeline mode: set inputDatasetId to the scraper's output dataset (e.g. {{resource.defaultDatasetId}} in a webhook payload) and textField to the field holding the text. See pipeline mode above.

What happens if the run fails? Patterns are compiled and the input is checked before any text is processed, so a bad regex, a duplicate pattern name or missing input fails the run immediately with a message naming the offending pattern — before the charge, and before a partial dataset exists. In pipeline mode, upstream items that lack textField are skipped and counted in the log rather than failing the run.

Disclaimer: Make sure you have the right to process any text and personal data (such as emails or phone numbers) you pass through this Actor, in line with applicable laws and the source's terms of service.

Found a bug or have a feature request? Open an issue on the Actor's Issues tab.

Data pipeline toolkit

Part of the Data pipeline toolkit — small, chainable Actors for cleaning, transforming, and generating data inside a larger pipeline:

Did you find this useful?

Rate this actor on Apify! Your feedback helps other users find it and helps us keep improving it.