in reply to Trim Two Characters On Line
should meet your requirement.
Bonus: $2 will hold the truncated characters.
Demo in the debugger
DB<1> $_ = 'abcSUMcdexx' DB<2> s/(SUM.*)(..)/$1/ DB<3> p abcSUMcde DB<3> $_ = 'abcSUXcdexx' DB<4> s/(SUM.*)(..)/$1/ DB<5> p abcSUXcdexx DB<5>
Update: typo fixed in DB<1> , thx to AnomalousMonk for spotting.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Trim Two Characters On Line
by AnomalousMonk (Archbishop) on Oct 23, 2020 at 04:26 UTC | |
by LanX (Saint) on Oct 23, 2020 at 08:07 UTC |