Search and replace

Does Codea have a way to search a file for all occurrences of a word, and then replace all those occurrences with a different word with a single click? This search and replace feature, that I am attempting to describe, is a common feature in word processors.
Or do I need a word processor to do it? Thanks.

Since people are suggesting search&replace in that next version thread, I’m assuming I’m not just not seeing a button… but it does have a “way”:


Actually @damny, if what you’re trying to use is a string gsub? It won’t work that way you need to have the project read into it as if it were a string. so

m = string.gsub(readProjectTab("Main"), "search","replace")

would be the correct format.

Otherwise @Kempoman, what @damny posted is correct.

Alternatively I have been using a find and replace app in tandem with selecting, cutting, and pasting code into said app and then using it to find and replace what is desired.

You could do that but I think the caveat be careful what you wish for may apply here as well. Suppose you change stuff you DON’T want to change on accident simply because it shares characteristics with what you wanted to change.

Thus you’d then have to go back and fix what you changed because you weren’t careful with said initial change parameters.

@MRQ Actually, @damny is right. It’s proper syntax, it doesn’t matter if it’s string.gsub(string, search, replace) or string:gsub(search, replace). Calling something like

player = Player()

is no different from

player = Player()

Could write a small app for find/replace. Let the user verify before gsub is used. In the past I’ve used textastic.

I see someone already did that :slight_smile: Otherwise I might have, I thought about simply saving the original in a backup tab, all commented out…