KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/share/zsh/4.2.6/functions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/zsh/4.2.6/functions/replace-string
emulate -L zsh
setopt extendedglob

autoload read-from-minibuffer

local p1="Replace: " p2="   with: "
local src rep REPLY MATCH MBEGIN MEND curwidget=$WIDGET
local -a match mbegin mend

read-from-minibuffer $p1 || return 1
src=$REPLY

read-from-minibuffer "$p1$src$p2" || return 1
rep=$REPLY

if [[ $curwidget = *pattern* ]]; then
    local rep2
    # The following horror is so that an & preceded by an even
    # number of backslashes is active, without stripping backslashes,
    # while preceded by an odd number of backslashes is inactive,
    # with one backslash being stripped.  A similar logic applies
    # to \digit.
    while [[ $rep = (#b)([^\\]#)(\\\\)#(\\|)(\&|\\<->|\\\{<->\})(*) ]]; do
	if [[ -n $match[3] ]]; then
	    # Expression is quoted, strip quotes
	    rep2="${match[1]}${match[2]}${match[4]}"
	else
	    rep2+="${match[1]}${match[2]}"
	    if [[ $match[4] = \& ]]; then
		rep2+='${MATCH}'
	    elif [[ $match[4] = \\\{* ]]; then
		rep2+='${match['${match[4][3,-2]}']}'
	    else
		rep2+='${match['${match[4][2,-1]}']}'
	    fi
	fi
	rep=${match[5]}
    done
    rep2+=$rep
    LBUFFER=${LBUFFER//(#bm)$~src/${(e)rep2}}
    RBUFFER=${RBUFFER//(#bm)$~src/${(e)rep2}}
else
    LBUFFER=${LBUFFER//$src/$rep}
    RBUFFER=${RBUFFER//$src/$rep}
fi

Anon7 - 2021