Changing replacing regexp to only remove ; at the end