perl -0777 -pe '$_=reverse;s{>ELBAT/<}{ECALPER};$_=reverse' test.htm [download]
In reply to Re: Match last instance of pattern by ccn in thread Match last instance of pattern by techie411