Actions26
- Block Actions
- Collection Actions
- Daily Note Actions
- Document Actions
- Folder Actions
- Task Actions
Block → Search Blocks
AI-generatedSummary
Searches for blocks containing a specified pattern within a given Craft document and returns matching blocks along with a configurable number of surrounding blocks as context.
Inputs
- Document ID (required) — The ID of the Craft document (root block ID) within which to perform the block search.
- Pattern (required) — The search pattern to find within blocks, supporting NodeJS regular expressions.
- Search Options — Optional parameters including case sensitivity and the count of blocks to return before and after each matched block (defaults to 5 each).
Output shape
A list of matching blocks with surrounding context blocks as specified by the Before Block Count and After Block Count options.
The output list includes blocks that match the pattern plus additional blocks before and after each match as context. The search honors case sensitivity based on the input option. Regular expressions can be used in the pattern to refine the search.
Examples
Example 1: Search for blocks containing the word 'n8n' in a specific document, returning 3 blocks of context before and 2 blocks after each match.
Set Document ID to the target document's root block ID, Pattern to 'n8n', Case Sensitive to false, Before Block Count to 3, After Block Count to 2.