Replace string in field attribute

Discussion created by ngaliats on Apr 20, 2012
Latest reply on Mar 5, 2014 by usmanpkz
In ArcGIS 9.x was in the options..., Find and Replace. In ArcGIS 10.x, we have to use Python script !FieldName!.replace("OldText", "NewText")

I may be missing something here, but why on earth the Python script is not working? Here is what I type in the Expression:

!Hyperlink!.replace("Dec20112", "Dec2011")

, and here is the message from the Geoprocessing results:

ERROR 000539: <type 'exceptions.SyntaxError'>: invalid syntax (<expression>, line 1)
Failed to execute (CalculateField).

I have managed to do the replacing with VBscript: Replace ([Hyperlink], "Dec20112", "Dec2011")

Any idea about what may be wrong with Python here? It says PYTHON 9.3; I'm running ArcGIS10sp4 under Win7-64bit.