Created
January 20, 2010 02:11
-
-
Save ap/281527 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 5.010; | |
use strict; | |
use SQL::Beautify; | |
my $sql = do { local $/; <> }; | |
$_ = do { | |
my $p = SQL::Beautify->new; | |
$p->query( $sql ); | |
$p->beautify; | |
}; | |
s{ \(\s* (\d+) \s*\) (?:\s*(\w))? } | |
{ "($1)" . ( $2 ? " $2" : "") }gsex; | |
s{ (\)) \n ([;,]) }{ $1 . $2 }gex; | |
say; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment