in reply to Is it possible to use repetition within a Regular Expression Substitution?
Update: Not directly, by any means I've found (nor by any explicitly sanctioned by </update> shmem found a "direct" means... but see Friedl, Mastering Regular Expressions, anyway.
However: TIMTOWTDI:
#!/usr/bin/perl use strict; use warnings; # 829735 my $replacement ="*"x80; print "$replacement \n"; my @logfile = <DATA>; for my $logfileline(@logfile) { $logfileline =~ s|^\-+|$replacement|; print "$logfileline \n"; } __DATA__ phoney content -------------------------------------- more dummy stuff
which appears to do what you want:
ww@GIG:~/pl_test$ perl 829735.pl ********************************************************************** +********** phoney content ********************************************************************** +********** more dummy stuff ww@GIG:~/pl_test$
NB: \-+ in the regex because I'm too lazy to count the hyphens. :-)
|
|---|