Text Processingflags: g
JSON Boolean / Null Literal
Match JSON `true`, `false`, and `null` literal values, with word boundaries to avoid partial matches.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
\b(true|false|null)\b (flags: g)Raw source: \b(true|false|null)\b
How it works
\b is a word boundary on both sides so we don't match inside `nullable` or `falsey`. (true|false|null) captures one of the three JSON literals. Useful for quick log scraping or schema-detection passes when full JSON parsing is overkill.
Examples
Input
{"active": true, "deleted": false, "deleted_at": null}Matches
truefalsenull
Input
active=true; expired=falseMatches
truefalse
Input
no literalsNo match
—Common use cases
- •Quick filtering of JSON-shaped log lines
- •Lightweight type-detection in observability pipelines
- •Documentation generation from JSON schemas
- •Test case extraction from inline JSON examples
Related patterns
JSON Key-Value Pair (Simple)
Text ProcessingExtract simple `"key": value` pairs from JSON-ish text (strings, numbers, booleans, null).
JSON Number (Strict)
Text ProcessingMatch JSON-spec numbers — disallows leading zeros (no `01`), allows decimals and exponents.
JavaScript Template Literal Placeholder
Text ProcessingMatch `${expression}` placeholders inside JavaScript template literals.
Hashtag
Text ProcessingMatch hashtags (# followed by word characters) in social media posts, including accented Latin characters.