Hi Bruce and William,
Ineed: I was looking for [\,] but your code removes the anoying empty
string because of the leading / (which is awesome) so I mixed from both
answers (<-[/]> is more robust than .alpha ) and added .Str to .say.
finally I got:
<<. raku -ne '.Str.say for m:ex /^ ["/" <-[/]>+:] **? 1..* /;'
/var/log/messages
ther is only one caracter I don't understand in this anwser so I
considered removing it. bad idea:
<<. raku -ne '.Str.say for m:ex /^ ["/" <-[/]>+ ] **? 1..* /;'
/var/log/messages
so I read about backtracking and found something I found a bit easier
to get/memorize: the :r adverb.
<<. raku -ne '.Str.say for m:ex{ ^ [ :r "/" <-[/]>+ ] **? 1..* }'
/var/log/messages
last but not least: **? 1..* is just +?. At this point, my prefered solution
is:
<<. raku -ne '.Str.say for m:ex{^ [:r "/" <-[/]>+]+? }'
/var/log/messages
and it is pretty good compared to the sed version:
<<. sed -E ':b p; s:/[^/]+$::; t b'
thank you very much to both of you: I learned a lot on this post.
--
Marc Chantreux
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200