{
"group": "Searching by text",
"entries": [
{
"name": "Records containing text",
"sentence": "Keep whole records whose compact JSON contains a pattern.",
"query": "${collection} | rg(${pattern})",
"change": "Change ${collection} to the collection name and ${pattern} to a JSON-quoted regular expression.",
"defaults": {
"collection": "patients",
"pattern": "\"4B\""
}
},
{
"name": "Text in one field",
"sentence": "Search one field and ignore matching text in other fields.",
"query": "${collection} | rg(.${field}; ${pattern}; ${flags})",
"change": "Change ${collection}, ${field}, ${pattern} and ${flags}; supported flags are -i, -s, -S, -w, -x, -F, -v and -U, their long forms and --no-ignore-case in one quoted string.",
"defaults": {
"collection": "patients",
"field": "ward",
"pattern": "\"4b\"",
"flags": "\"-i -F\""
}
},
{
"name": "Records without text",
"sentence": "Keep whole records whose named field does not match a pattern.",
"query": "${collection} | grep(.${field}; ${pattern}; \"-v\")",
"change": "Change ${collection}, ${field} and ${pattern}; -v keeps nonmatching records, including records without the field.",
"defaults": {
"collection": "patients",
"field": "ward",
"pattern": "\"4B\""
}
},
{
"name": "Whole field text",
"sentence": "Keep whole records whose named field matches the entire pattern.",
"query": "${collection} | rg(.${field}; ${pattern}; \"-x\")",
"change": "Change ${collection}, ${field} and ${pattern}; -x requires the whole field to match and overrides -w.",
"defaults": {
"collection": "patients",
"field": "ward",
"pattern": "\"4B\""
}
}
]
}