summaryrefslogtreecommitdiffstats
path: root/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to '.zshrc')
-rw-r--r--.zshrc19
1 files changed, 19 insertions, 0 deletions
diff --git a/.zshrc b/.zshrc
index 54ad658..0bd9324 100644
--- a/.zshrc
+++ b/.zshrc
@@ -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