In real life, those lines were paths, and I wanted all of then ending in a single slash.
Ah, I see. You want canonpath from File::Spec ;-) (doesn't add the trailing slash, but there are multiple possible solutions for that as well)
And this is admittedly not the prettiest solution, but it works: s{(?| /* (\n) | /+ (\z) | [^/] \K (\z) )}{/$1}mgrx. Or just split the input string on \n...
In reply to Re^6: You won't believe what this regular expression does!
by haukex
in thread You won't believe what this regular expression does!
by salva
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |