Is there a cleaner way via a regex to recurse through a series of '}' at the end of a line and insert newlines?
Specifically can:Get replaced by a single line of regex that recurses through text that contains many instances of /}+$/ and convert each '}' to \n}my $bracketend = 8 * $lines =~ s/\}\s*\}\s*\}\s*\}\s*\}<\s*\}\s*\}\s*\ +}$/\n\}\n\}\n\}\n\}\n\}\n\}\n\}\n\}/gms; $bracketend += 4 * $lines =~ s/\}\s*\}\s*\}\s*\}$/\n\}\n\}\n\}\n\}/gms +; $bracketend += 2 * $lines =~ s/\}\s*\}$/\n\}\n\}/gms; $bracketend += $lines =~ s/\}$/\n\}/gms;
In reply to Cleaner regex conversion by DanielNeedles
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |