Within an attribute table I'm trying to replace one string with another using the 'replace' function . As an example, there are a number of features whose field 'NAME' contain the string '(B)' and I'm wanting to replace this with the word 'County'. I'm selecting the 'update existing field' checkbox and using the following expression
replace( '(B)','(B)','County')
The end result is that the field 'NAME' for every feature is replaced by 'County' irrespective of whether or not the field 'NAME' originally contained the string '(B)'.
Best Answer
tells QGIS to replace the '(B)' in '(B)' with 'Country'.
You want
= replace the '(B)' in "Name" with 'Country'.
Note that the double quotes indicate a field name while the single quotes refer to a static string. These are not interchangeable.