Search-replace field content

Hi,

I’d like to apply a naming convention to my field contents and replace, for e.g. ‘one two three’ with ‘one-two-three’. I’ve searched on here for ways of using search-replace and also looked at the docs but can’t figure out how to apply it.

I have multiple tiddlers with the field ‘key’ and I’d like to apply the changes globally to that field. Also, I’d need a button to execute it?

Thanks
Jon

See this for making a button to do this kind of thing How to have your code and action it too - batch operations on multiple tiddlers, refactoring your wiki and this example of a space to hyphen filter

{{ [<string>search-replace:g[ ],[-]] }}}

I can give more later/tomorrow if you need it.

Thanks, but that’s beyond me I’m afraid :pensive:

The Commander plugin has a built-in search and replace feature (and I highly recommend it for your other batch-processing needs as well.)

Can you elaborate on how it was done? I’m in a situation where I need to clear spaces and line breaks from selected text in the edit state.

Yes, Commander is great and use it a lot but I don’t think it would work in this case as I have multiple entries in the field and want to only alter some of them. E.g the field may contain ‘apple orange passion fruit’ and I want to change it to ‘apple orange passion-fruit’. Commander can set the whole field value but I don’t think it can set part of it.

The “Snr” tab (rather than the Field tab) has the functionality you’re looking for.

1 Like

By Jove your right! I’d looked at this before and thought you could only do it on one tiddler at a time - but just found it can apply to all the tidders selected by the filter at the top.

Many thanks
Jon

@Jon so you have your answer? Mark a reply as a solution.

@dongrentianyu the links I have were for @Jon and they do elaborate. If you want further assistence perhaps you could elaborate? Try the tools linked to, or perhaps start your own topic.