In this short article, we will show you how to replace text/string in a Text column in ArcGIS Pro. There are several ways to do this but in this example, we will use the Calculate Field tool that comes with ArcGIS Pro.
Here’s an example of how to remove text from a field in ArcGIS using the “Calculate Field” tool:
- Open ArcGIS and add the layer containing the field you want to modify.
- Right-click the layer in the Table of Contents and select “Open Attribute Table”.
- In the Attribute Table, right-click the field you want to modify and select “Calculate Field”.
- In the “Calculate Field” dialog, select the field to modify from the “Field” dropdown list.
- For the “Expression” section, enter the following code:
!fieldname!.replace("text to be replaced", "Replaced text")
Replace “fieldname” with the name of your field, and replace “text to be removed” with the text you want to remove from the field.
- Set the output type to “Python” and click “OK”.
This will remove the specified text from all records in the field. The modified field values will be updated in the Attribute Table.
Example:
In the following example, we will replace the text “Text Replace” with “Replaced” in the MSAccessQuery column. You can adopt and adjust this sample with your own data.