first-regex-match

The first-regex-match operation pulls a piece out of a value using a pattern. It finds the first thing that matches and returns just that.

Use it when the value you need is buried in text: an order number in a sentence, a code inside an identifier, digits inside something formatted.

How it works

You write a regular expression in the parameter. The operation searches the value and returns the first match.

Pattern: \d+          Value: Order n. 12345      Result: 12345
Pattern: [a-z]+       Value: 123 ABC xyz         Result: xyz
Pattern: ^\d{2}       Value: 5501150325          Result: 55

The whole match is returned, not a captured group. Brackets in your pattern help you describe what to look for, but the result is always the entire matched section.

When nothing matches

The result is an empty string. Not the original value, and not an error. The field ends up blank.

That is the behaviour to plan around, because an empty field usually travels on quietly. The advertiser receives nothing where they expected an order number, and the rejection that follows will not mention the pattern.

The same thing happens when the pattern itself is invalid. A stray bracket or an unescaped character gives you an empty result rather than a complaint, so a broken pattern looks exactly like a value that did not match.

Check for the empty case afterwards. A condition on the connection leaving the node, or a following step with the condition is empty, is enough to tell the two situations apart from a lead that simply had nothing to find.

Only the first one

If the value contains several matches, you get the first. There is no way to ask for the second, or for all of them.

When you need more than one piece out of the same value, extract each into its own field, each with its own pattern anchored to a different position.

Test the pattern first

Write the pattern somewhere you can see it working before you paste it into PalDock. regex101.com shows you what matches and why, which the editor cannot.

This matters more than usual here, because of the silent failure. A pattern that is subtly wrong produces the same empty string as no pattern at all.

If you generate the pattern with an AI tool, test it anyway. They are good at plausible patterns and less good at correct ones, and the failure mode here gives you nothing to notice.

Changing rather than extracting

first-regex-match takes a piece out and throws the rest away. To keep the value and rewrite part of it, use regex-replace, which is where capturing groups do what you would expect.

Reference

Patterns follow PHP’s PCRE syntax. See PHP: Pattern Syntax.

Insights that
helps you grow

  • Release notes 2026/08/14
    This was a big one. We went through roughly 200 pages of our knowledge base and rewrote the whole thing. Clearer structure, consistent terminology, and…
  • Release notes 2026/07/31
    What’s new in PalDock? A lot of this month went into things you won’t see directly – query optimisation, indexing, and general tuning under the…
  • Free Affiliate tracking software
    Many companies (inlcuding YOU) search for free affiliate tracking software because they want to launch an affiliate program without committing to expensive monthly fees. The…