Created
October 2, 2014 02:41
-
-
Save kazuho/1d09fdbedde0c0d8891e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
my $re_paren; | |
$re_paren = qr { | |
\( | |
(?: | |
(?>[^\(\)]+) | |
| (??{ $re_paren }) | |
)* | |
\) | |
}xs; | |
my $re_str = qr{"(?:\\"|[^"]*)*"}; | |
my $src = join '', <STDIN>; | |
$src =~ s{ | |
(?:(?<=[^A-Za-z0-9_])|^) | |
sprintf \s* | |
\( \s* | |
" ( (?:\\"|[^"]*)* ) " | |
(?: \s* , \s* ($re_paren|[^,]*) )* | |
\) | |
}{ print "yeah!:$1,$2,$3" }gxs; | |
print $src; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment