C-u M-x occur \"\(#[^\"]+\)\" <RETURN> \1
(this strips the quotes)
or
C-u M-x occur "#.+\" <RETURN>
(this keeps the quotes)
occur
finds all lines that match the provided regexp. Calling it with the prefix argument (C-u
) returns only the matched text, not the complete lines. Using the capture group (\(...\)
) lets you select the group, while ignoring the enclosing quotes. If you don't care about including the quotes, you can drop the capture group.
For example:
(let (
(base00 "#081724")
(base01 "#033340")
(base02 "#1d5483")
(base03 "#2872b2")
(base04 "#d3f9ee")
(base05 "#a6f3dd")
(base06 "#effffe")
(base07 "#fffed9")
(red "#ff694d")
(orange "#f5b55f")
(yellow "#fffe4e")
(magenta "#afc0fd")
(violet "#96a5d9")
(blue "#bad6e2")
(cyan "#d2f1ff")
(green "#68f6cb")
(twsblue "#0000ff"))
Calling occur
as above produces:
#081724
#033340
#1d5483
#2872b2
#d3f9ee
#a6f3dd
#effffe
#fffed9
#ff694d
#f5b55f
#fffe4e
#afc0fd
#96a5d9
#bad6e2
#d2f1ff
#68f6cb
#0000ff
#002b36