Tinderbox Forum

How to change commas to semi-colons in List/Set attributes?

Hellp to all,
I have an a-old bunch of notes with a List attribute called $Mots (words in French) that contains a list of keywords.
I wrongly was separating these keywords by a “,” (a comma). Want to change these to a “;” semi-colon.
I tried to create an agent that collects these notes et modifies the content of the List attribute


but it doesnt work.
Throught it was a GREP issue, so I tried:

$Mots.contains(",") [that is a inverted slash+the comma]

it doesnt work either.

The idea is once this group of notes is identified, to have a simple: Rule or Action:

Any idea?

All the best from Paris.

Where is the ‘inverted slash’ in the code. I think you’re describing this:


If I understand correctly, you have a List-type user attribute called ‘Mots’ and a problem like this:

…where ‘bee’ and ‘cow’ should be two separate values rather than one, as shown above.

To fix that, I added a stamp to my document with this code:

$Mots = $Mots.replace(",",";");

The result?

Fixed! You don’t have to use a stamp. The same code could be used in an agent action, edict, etc.

If you used comma+space rather than comma to add values to your list, the code needed is:

$Mots = $Mots.replace(", ",";");

Note the extra space in the replace search string (the first argument).

Thanks a lot, Mark.

As always excellent explanation. But, to my amazement this is EXACTLY what I did and it didnt change the commas in semi-colons…

In fact I tried to create an agent, inorder to change all the notes with commas.

I tried gathering all notes with commas in the attribute $Mots,


and it didnt work.

And I was hoping to have something like this for the agent to change the commas…


Anyway, the stamp you propose works beautiful.

Thank you very much.


Yes, that would not work for the reason explained here: when working on a list (List or Set type), the .contains/.icontains operators can only match entire list values. Don’t feel bad - I was only reminded of this on checking aTbRef after testing your comma query and confirming it didn’t work!

Consider my test with the $Mots with contents “ant;bee,cow”, i.e. it holds two values ‘ant’ and ‘bee,cow’. Thus $Mots.contains() can only match ‘ant’ or ‘bee,cow’. A single character cannot be matched.

The answer to using an agent is to use some other method to gather the notes. For instance the query $Mots will gather all notes that have a value for $Mots. Now we can run the stamp code above as the agent action.

The action will act on all aliases in the agent. This is not a problem as the action only replaces unwanted commas. Notes matching the query that have no such commas are not affected.

I hope that makes sense - if not, do ask.

Great ! Thank you very much Mark – mystery solved.
The stamp method is more in line with the “Tinderbox spirit”, that is gardening, rather than automatizing everything. I’ll have to review one by one my notes and continue gardening.

From confined France :slight_smile:

1 Like

Thanks and be well! :vulcan_salute:

1 Like