Skip to content

bmel:matchesPattern

Category: LLM & AI Observability · Returns: bmel:boolean

bmel:matchesPattern(text: bmel:string, pattern: bmel:string)

Description

Returns true if the text matches the given regular expression pattern. Useful for validating that structured outputs (JSON, XML, email, UUIDs, ISO dates) conform to the expected format, and for detecting undesired patterns such as apology phrases or refusal templates in LLM responses.

Arguments

Parameter Type Required Description
text bmel:string The text to match against.
pattern bmel:string Regular expression pattern (Java/ECMAScript syntax).

Example

bmel:matchesPattern({chat:Response Payload}.$.content, "^\\{.*\\}$")

Back to BMEL Reference