Design a filter to find the source set. You may need multiple components to the filter to capture all and only all the source set. Alternatively make a note of the additional elements that need including or excluding in the source set and address them manually later.
Run the filter on the input.
Check the filtered source set matches everything you want and nothing you don’t.
Do the replacement without expanding the output set - ensure existing items won’t match a filter for the newly created output items if you don’t want them to.