From 4ae3a36ad3ee679b3a93a85ace4af693c6d08db7 Mon Sep 17 00:00:00 2001 From: Morgan Date: Wed, 12 Feb 2020 22:30:25 +0100 Subject: [PATCH] regex --- cheat/regex.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cheat/regex.md diff --git a/cheat/regex.md b/cheat/regex.md new file mode 100644 index 0000000..43d6ca9 --- /dev/null +++ b/cheat/regex.md @@ -0,0 +1,6 @@ +### Print only the captured group ([src](https://unix.stackexchange.com/a/13472/220566)) + +Example with expression `key=value toast=pain hello=bonjour` +if you want to capture only what comes after `key=`, you can use : +`grep -oP 'key=\K\w+'` +