1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #!/usr/bin/env raku
use v6;
my @l;
push(@l,"* simple titre");
push(@l,"* TODO simple titre avec todo");
push(@l,"* TODO [#A] simple titre avec todo et priorité");
push(@l,"* [#A] simple titre avec priorité");
push(@l,"* TODO [#A] avec tout :test:suite:");
push(@l,"* juste un tag :essai:");
for @l {
say "original : ",$_;
# if $_~~ /^"* " ((["TODO"|"DONE"])" ")? ((\[\#[A|B|C]\])" ")? (.*) / { # ce qui marche mais évidemment ne sépare pas tache et tag
# if $_~~ /^"* " ((["TODO"|"DONE"])" ")? ((\[\#[A|B|C]\])" ")? (.*?) (" "(\:.*))? / { # ce qui devrait marcher mais qui ne marche pas du tout
if $_~~ /^"* " ((["TODO"|"DONE"])" ")? ((\[\#[A|B|C]\])" ")? (.*?) (" "(\:.*)) / { # ce qui marche quand il y a un :tag:, les deux derniers exemples
print "résultat : * ";
print $0[0]~" " if $0[0];
print $1[0]~" " if $1[0];
print $2;
print $3 if $3;
say "";
say "todo : "~$0[0]~" " if $0[0];
say "priority : "~$1[0]~" " if $1[0];
say "tache : "~$2;
say "tag : "~$3[0] if $3[0];
} else {
say "Plus ça rate et plus on a de chances que ça marche..."
}
say "";
} |