The Regex block is deprecated and isn't available in Postman Flows. To use a regular expression for processing data, include the regex in your TypeScript or FQL code in an Evaluate block.
Using a regex in an Evaluate block can be a powerful approach. Here's an example:
Suppose you have a JSON array of objects that describe auto service invoices. From these invoices, you want to extract the line items for brake hardware - that is, anything to do with brakes that’s not brake fluid.
In your Evaluate block's TypeScript expression, a plain .includes ("brake")
isn't enough, because it still matches the string "brake fluid" that you want to exclude.
Instead, you can use a regex that matches strings that contain the word "brake" but only if they're not followed by the word "fluid". You can do this with a negative lookahead - (?! fluid)
in this case - to exclude items that contain the unwanted string.
If you name the Evaluate block's input variable invoices
, the whole TypeScript expression might look like this:
regex = /\bbrake(?! fluid)\b/i;
invoices.flatMap(inv =>
inv.line_items.filter(item => regex.test(item.description))
);
The TypeScript expression filters and maps the JSON input, using the regex to extract only the desired items. The complete flow shows how this looks:
Last modified: 2025/07/25