I am using ArcMap 10.7.1.

I want to insert a space into a string between specific parts of the string using Field Calculator:

!FIELD! .replace("F'target", "F 'target")

Neither 'F' or 'target' are at beginning or end of string, those characters are in the middle of a string.

I run the calculation, and nothing happens. I've tried to escape the single quote, but no difference. Do I need a wildcard tag at beginning and end of the substring?

1 Answer 1


No need for wildcards, the replace() method searches the whole string, as you can see if you test it out in the Python interpreter:

>>> "Test string with F'target in the middle".replace("F'target", "F 'target")
"Test string with F 'target in the middle"

Double check that the exact string F'target does indeed appear in your field.

  • i looked closely and I found the problem, the first single quote was " ‘ " instead of " ' " Not sure how that got there but that was it.
    – JasonBK
    Commented Aug 27, 2021 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.