Find and Replace rules allow you to transform the source metadata before deploying them to the target org. Some of the examples where Find & Replace rules can be used:
You wish to ignore specific user permissions related to profiles that might cause deployments to fail.
You wish to replace all the IP ranges with the values specific to the target Org
You wish to remove manage package components from your deployments.
Adding Find & Replace Rules
In the deployment details page, select the "Deployment Options" tab, then expand the "advanced options" and you will see the text area to enter Find & Replace rules as the screenshot below.
Rules Format
Find & Replace rules should be in YAML format. The syntax is as simple as the sample below:
rule1_update_iprange:
file_filters:
- '*Admin*.profile'
- '*Sales*.profile'
replace_rules:
- find: '192.168.1.1'
replace: '0.0.0.0'
- find: '192.168.1.255'
replace: '255.255.255.255'
rule2_remove_user_permissions:
file_filters:
- '*.profile'
replace_rules:
- find: '(?s)\s*(.*?)'
replace: ''
rule3_remove_category_group_visibilities:
file_filters:
- '*.profile'
replace_rules:
- find : '(?s)\s*(.*?)'
replace : ''