From 49eb38b409de8a7aa6ed29c185ce208e4f0c0ec5 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 22 Jan 2024 20:19:33 +0100 Subject: Update the README --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c665a49..2f652d0 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ command is optional. For example, a pattern string may look like ‘`x/[a-z]+/ g.foo. v/bar/`’. -The available operators are ‘g’, ‘G’, ‘x’, and ‘X’. The ‘g’ and ‘G’ -operators are filter operators, while ‘x’ and ‘X’ are selection -operators. +The available operators are ‘g’, ‘G’, ‘h’, ‘H’, ‘x’, and ‘X’. The ‘g’ +and ‘G’ operators are filter operators, the ‘h’ and ‘H’ operators are +highlighting operators, and ‘x’ and ‘X’ are selection operators. You probably want to begin your pattern with a selection operator. By default the entire contents of the file you’re searching through will be @@ -90,6 +90,21 @@ following: grab 'x/[0-9]+/ g/3/ G/^1337$/' /foo/bar ``` +The final set of operators are highlighting operators. They don’t change +the text that is ultimately matched in any manner, but instead highlight +the matched text in the output. If given the empty regular expression +the ‘h’ operator will highlight according to the same regular expression +as the previous operator. + +The following examples select words with a capital letter, and highlights +all the capital letters: + +```sh +# These are both the same +grab 'x/\w+/ g/[A-Z]/ h/[A-Z]/' /foo/bar +grab 'x/\w+/ g/[A-Z]/ h//' /foo/bar +``` + ## Examples -- cgit v1.2.3