node-red-contrib-match is a Node-RED package providing a dedicated node for advanced message filtering within a flow. It enables users to define multiple rules to check specific properties within an incoming message, or global/flow contexts, against static values, other properties, previous values, ranges, regex, types, and null/boolean states. Messages satisfying all defined rules are routed to the first output, while those failing any rule are sent to the second output. The current stable version is 1.0.2. Release cadence appears to be infrequent, primarily for bug fixes based on recent releases. Its key differentiator is the comprehensive set of comparison operators and the ability to probe deeply into objects and arrays, offering more granular control than standard switch nodes.
npm install node-red-contrib-matchVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install the Node-RED 'Match' node and provides conceptual guidance on its graphical use within the Node-RED editor.
Use the Node-RED debug panel to inspect incoming message structures (`msg`), and ensure your rule configurations accurately reflect the expected data types and paths. Use type-specific comparisons where available.
Initialize context variables upstream in your flow using `change` nodes or function nodes. Use the context sidebar in the Node-RED editor to verify context values during debugging.
Optimize your flow by pre-filtering messages if possible, or breaking down complex matching into multiple simpler Match nodes. Profile your Node-RED instance if performance bottlenecks are suspected.
For 'OR' logic, use multiple Match nodes in parallel, each with a single rule, and then merge their outputs with a `join` node. For 'AND' logic, use a single Match node with multiple rules, or cascade them sequentially.
Run `npm install node-red-contrib-match` in your Node-RED user directory (usually ~/.node-red), then restart your Node-RED instance. Verify installation in the 'Manage palette' menu.
Use a `debug` node set to 'Complete msg object' immediately before the `match` node to thoroughly inspect the incoming message payload and structure. Check context values in the sidebar. Adjust rule configuration to match actual data types and paths.
Correct the property expression syntax. Use the '...' button next to the property field in the editor to visually browse available message properties and construct the path correctly. Ensure arrays are accessed with numeric indices and objects with keys.
Test your regular expression with a dedicated regex tester. Ensure the input property being matched is indeed a string. Add appropriate flags (e.g., `i` for case-insensitivity) if needed in the regex configuration.