I am not an expert in AI or ChatGPT, so I cannot help you with that. Baserow uses it own formula language:
From: Baserow Formula Technical Guide // Baserow
Baserow formulas are written in the open source Baserow Formula language which is a simple expression based language similar to formulas you will find in other spreadsheet tools.
In other words, it works similar to Airtable, Google Sheets or MS Excel formulas, but it has its own syntax.
I check your question again, and I think the easiest way to solve it is to divide your “problem” into smaller portions. In the screenshot below, the field ‘Remove right’ holds the final value. You can hide all the other fields. The test data ensures that all scenarios are tested.
- Field 1 (Concat): Concatenate all fields with an underscore:
- Field 2 (Regex): check for double underscores and replace them with a single one:
regex_replace(field('Concat'), "__", "_")
- Field 3 (Remove left): check if the first character is an underscore, and remove it if true:
if(left(field('Regex'),1) = '_', right(field('Regex'), length(field('Regex')) - 1), field('Regex'))
- Field 4 (Remove right): check if the last character is an underscore and remove it if true:
if(right(field('Remove left'),1) = '_', left(field('Remove left'), length(field('Remove left')) - 1), field('Remove left'))
You can now hide (but not remove) fields 1 - 3. You can nest formulas if you want less columns, but dividing a problem into partial problems keeps your formulas more readable and easer to understand if you need to change them later.