Update zsh-syntax-highlighting plugin
[zsh.git] / .zsh / zsh-syntax-highlighting / docs / highlighters / regexp.md
1 zsh-syntax-highlighting / highlighters / regexp
2 ------------------------------------------------
3
4 This is the `regexp` highlighter, that highlights user-defined regular
5 expressions. It's similar to the `pattern` highlighter, but allows more complex
6 patterns.
7
8 ### How to tweak it
9
10 To use this highlighter, associate regular expressions with styles in the
11 `ZSH_HIGHLIGHT_REGEXP` associative array, for example in `~/.zshrc`:
12
13 typeset -A ZSH_HIGHLIGHT_PATTERNS
14 ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold)
15
16 This will highlight "sudo" only as a complete word, i.e., "sudo cmd", but not
17 "sudoedit"
18
19 The syntax for values is the same as the syntax of "types of highlighting" of
20 the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
21 manual page][zshzle-Character-Highlighting].
22
23 See also: [regular expressions tutorial][perlretut], zsh regexp operator `=~`
24 in [the `zshmisc(1)` manual page][zshmisc-Conditional-Expressions]
25
26 [zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
27 [perlretut]: http://perldoc.perl.org/perlretut.html
28 [zshmisc-Conditional-Expressions]: http://zsh.sourceforge.net/Doc/Release/Conditional-Expressions.html#Conditional-Expressions