diff options
Diffstat (limited to '.zshrc')
-rw-r--r-- | .zshrc | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -429,6 +429,25 @@ __chrootshell() { sudo umount "$chrootdir/union-shell" } +# source: http://github.com/trapd00r/configs/blob/master/.zsh/functions.zsh +regcheck() { + if [[ -z $1 ]] || [[ -z $2 ]] || [[ $1 = "-h" ]]; then + echo -e "${blue}Usage:$NC regcheck <regexp> <string>"; + return 1 + fi + + emulate -L zsh + zmodload -i zsh/pcre + pcre_compile $1 && \ + if pcre_match $2; then + echo -e "${green}matches$NC" + return 0 + else + echo "${red}no match$NC" + return 1 + fi +} + # }}} # History {{{ export HISTFILE=~/.zsh/histfile |