Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry if this is a dumb question, but I am wondering if there is a way to copy the text from one field to a new field, but eliminate specific words. For example:

**Old Field**                         **New Field**

Killbear Provincial Park               Killbear
Quetico Provincial Park                Quetico
La Cloche Provincial Park              La Cloche
Wildcat Hill Provincial Park           Wildcat Hill

I thought of trying a trim function, but not all the values have the same start location or trim length.


share|improve this question
up vote 4 down vote accepted

In your attribute table create a new string column and then use the field calculator as follows:

 replace(OLD_FIELD, 'Provincial Park','')

The problem with this approach is that your fields won't be trimmed, so you can do the following little hack to address that:

 replace(OLD_FIELD, ' Provincial Park ','')
 replace(OLD_FIELD, ' Provincial Park','')
 replace(OLD_FIELD, 'Provincial Park ','')
 replace(OLD_FIELD, 'Provincial Park','')
share|improve this answer
Thank you, that worked great... – Ryan Garnett Sep 7 '12 at 13:46

How about removing all the occurrences of " Provincial Park" A search/replace ought to do the trick.

share|improve this answer
Thank you work. I didn't know you could do a replace in QGIS, I see the Search option, but not the replace – Ryan Garnett Sep 7 '12 at 13:03
If you're working with a shapefile, you could edit the .dbf file directly with Excel and do your search/replace there. Unfortunately newer versions of Excel (2007, 2010) no longer let you save to DBF. Would work if you have Excel 2003 or earlier. – Rayner Sep 7 '12 at 13:07
There's always LibreOffice Calc which handles DBF files just fine. – n1kn0k Mar 6 '13 at 3:32
Good to know. Wasn't aware of that. Thanks. – Rayner Mar 6 '13 at 12:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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