Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
foreach (@newlist) { $_ =~ s/[.](.*)/($section) }
The above code performs the transform cat.1 ---> cat(1) It also performs the transform ls.so.conf.5 ---> ld(5) # which is WRONG! Is there a way to generalize this regex so it does: cat.1 ---> cat(1) ld.so.conf.5 ---> ld.so.conf(5) Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Generalizing a REGEX
by davido (Cardinal) on Aug 08, 2020 at 19:33 UTC | |
by Anonymous Monk on Aug 09, 2020 at 16:36 UTC | |
by Anonymous Monk on Aug 08, 2020 at 22:41 UTC | |
Re: Generalizing a REGEX
by haukex (Archbishop) on Aug 08, 2020 at 19:02 UTC |
Back to
Seekers of Perl Wisdom