AnsweredAssumed Answered

Need help with Replace in Field Calculator

Question asked by BritishSteel on Jul 30, 2012
Latest reply on Jul 30, 2012 by jskinner-esristaff
Hi everyone,

I am trying to set up a probably very easy expression, but it looks like I???m missing something. Even though I have python background I am new to using it in the Field Calculator (this is actually my first time trying it).

OK, so in order to be able to correctly join a table to a shapefile I had to modify river names. I ended up adding an underscore + a number to specific river segments. The attached screenshot shows what I mean.


Now, after successfully joining my table I would like to get rid of that extension.
I assume that the replace method is the correct one and according to Desktop Help the syntax should be as follows:

!STATE_NAME!.replace("california", "California")

Now, nothing is happening when running my syntax:

!Gewässerna!.replace("_%", "")

Am I not allowed to use a wildcard? Or am I not allowed to replace a string with nothing? Or am I not allowed to replace parts of a string in the first place?

Again, I???m fairly new to using coding in the Field Calculator. I appreciate your help!