easy regexp by emoken

s/.*/@&\n/
:1
h
/@(/{
s/@(\([^)]*\))\(.*\)/@\2/
x
s//\1/
s/|\|^/%/g
b
}
/@\[/{
s/@\[\([^]]*\)\]\(.*\)/@\2/
x
s//\1/
s/./%&/g
b
}
/@\w/{
s/@\(.\)\(.*\)/@\2/
x
s//%\1/
b
}
s/@.//
q
:
x
/@?/{
s/?//
x
s/^/%/
x
}
:3
G
:4
s/\n\([^\n]*\)\([^%]*\)%\([^%]*\)/\n\1\2=\1\3/
t4
s/\n\([^\n]*\)//
/\n[^=]/b3
s/=/\n/g
s/\n\n/\n/g
b1

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page