added option to perform substition across all matches