Mercurial > repo
changeset 4728:3339ace022d7
<oerjan> fetch http://oerjan.nvg.org/esoteric/slashes/ircslashes.pl
author | HackBot |
---|---|
date | Sun, 24 Aug 2014 23:07:01 +0000 |
parents | 7293bdf6d696 |
children | 417963e20c08 |
files | ircslashes.pl |
diffstat | 1 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ircslashes.pl Sun Aug 24 23:07:01 2014 +0000 @@ -0,0 +1,23 @@ +#!/usr/bin/perl -w +#By Ørjan Johansen, 2009-2012. This file is in the public domain. + +$| = 1; +my $l = 0; + +$_ = join '', <>; +while ($l < 512) { + if (s!^([^/\\]+)!! or s!^\\(.)!!s) { + $l += length($1); + print($1); + } + else { + if (s!^/((?:[^/\\]|\\.)*)/((?:[^/\\]|\\.)*)/!!s) { + my ($s,$d) = ($1,$2); + $s =~ s/\\(.)/$1/gs; + $d =~ s/\\(.)/$1/gs; + while (s/(?:\Q$s\E)/$d/) { + } + } + else { last; } + } +}