Created
July 25, 2016 17:36
-
-
Save Freezerburn/e383f4c1b797b720653c472044c59620 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
my $filename = 'test.ftl'; | |
my $grep-filename = $filename.split('.')[0 ..^ *-1] # Get the filename part: foo.bar.ftl -> (foo bar) | |
.join('') # Make it a string: (foo bar) -> 'foobar' | |
.split('') # Make it a list: 'foo' -> ( f o o ) | |
.map({ '.*' ~ $^a })[1 .. *] # Add regex wildcards and remove extraneous string: ( f o o ) -> (.*f .*o .*o .*) | |
.join('') # Turn it back into a string: (.*f .*o .*o .*) -> '.*f.*o.*o.*' | |
~ $filename.split('.')[*-1]; # Add the file ending back in: '.*f.*o.*o.*.ftl' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error is at line 5 '.map ...'. Commenting that line out will run fine.