Question

How to insert a character into specific position for many attributes?

  • 27 March 2020
  • 2 replies
  • 56 views

I'm trying to update a large file with many attributes. The original file's attribute names followed a specific nomenclature with 4 alphanumeric chars, then an 'X', then followed by 3 digits. An example:

ZA01X001

The new file now has the 'X' stipped out, so the new example is:

ZA01001

My problem is that my workflow uses an AttributeManager to rename about 80 different attribute names from a separate lookup table that corresponds the attribute coded name to a variable name like so:

ZA01001 = Total Population with Medicaid Coverage

So this new file is throwing off my AttributeManager with the 'X' now gone. My question is, how can I use the BulkAttributeRenamer or other method to easily insert an 'X' into the 4th position of all attribute names?


2 replies

Userlevel 1
Badge +21

Try this, regular expression replace - match the first 4 characters then replace with those 4 characters and an X

That worked perfectly! Thank you very much @ebygomm

Reply