Skip to content

Instantly share code, notes, and snippets.

@samcv
Created April 26, 2017 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samcv/258a705b46e5085c2ce76808552b209a to your computer and use it in GitHub Desktop.
Save samcv/258a705b46e5085c2ce76808552b209a to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
my $json = Q:to/END/;
{
"name" : "Math::FourierTransform",
"source-url": "git://github.com/MattOates/Math--FourierTransform.git",
"author": "Matt Oates",
"source-type": "git",
"depends": [
],
"provides": {
"Math::FourierTransform": "lib/Math/FourierTransform.pm6"
},
"version": "0.0.1",
"description": "Discrete Fourier Transform implementation."
}
END
my $nl = "\n";
my $license = "Artistic-2.0";
say $json ~~ s/ ^^
$<leading>=(\s*)
$<whole>=( '"name"' $<mid>=(\s*) ':' $<midafter>=(\s*) '"'.*? $$)
/$<leading>$<whole>$nl$<leading>\"license\"$<mid>\:$<midafter>\"$license\"/;
say $json;
#say $<leading>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment