In QGIS 3.18.3, I have a GeoPackage attribute table containing a string field that I will call
"FIELD_1". All records within
"FIELD_1" take the form of a_a_a_a_a, where a = alphanumeric text of varying lengths.
The only consistent pattern within
"FIELD_1" is that there are always exactly four underscores, each separated on both sides by the alphanumeric text.
I need to insert additional text (which I will call 'b') of fixed length immediately to the right of the fourth underscore, so that the output becomes a_a_a_a_ba.
I've reviewed the string functions in the field calculator, and I think that I need to do something like
rpad(), but only after the fourth underscore. If that is the correct methodology, how do I identify the fourth underscore? Or is there a more generic approach to inserting strings in such cases?