Actions14
- Document Actions
- Block Actions
- Collection Actions
- Search Actions
Block → Search in Document
AI-generatedSummary
Search for matching content blocks within a specified Craft document using a regular expression pattern.
Inputs
- Document Name or ID (required) — Select the target document to search within by choosing from the dropdown or specifying an expression that evaluates to a document ID.
- Search Pattern (required) — Input a search pattern using RE2-compatible regex syntax to find matching content blocks.
- Options — Configure search behavior: enable case sensitivity; specify the number of blocks to include before and after each match to provide context (from 0 to 5, default 5).
Output shape
a list of matching content blocks from the specified document with contextual blocks before and after each match according to options set
Returns block data matching the search pattern within the given document. The results include the requested number of preceding and following blocks for context. The search respects case sensitivity if enabled. The search pattern must be provided in RE2-compatible regex syntax.
Examples
Example 1: Find all blocks mentioning 'meeting' or 'agenda' in a specific document, case insensitive, returning 5 blocks of context before and after each match.
Set the Document ID parameter to the target document, enter 'meeting|agenda' as the search pattern, ensure 'Case Sensitive' is false, and keep 'Blocks Before' and 'Blocks After' at default 5.