Could you explain how Find and Replace can help to find specific text and return it? It will be more beneficial to get exact location for every occurrence.
According to the APIs and documentation there is only one function with 4 overloads -
Document.getRange().replace(). This one returns only integer value - number of made replacements.
Please, elaborate on how can Find be performed without replacement - for instance, I have a regular expression and want to find all values, but replace every occurrence of unique value with new unique value.
For example - looking for name in the string “John and Mike were there. John and Michelle have bicycles. Mike, Roger, and Stephany play basketball.”
regular expression picks names. Now I have list of names and their replacements:
John -> Oren
Mike --> Jim
Michelle -> Alice
Stephany -> Carol
Roger -> Jeff
Now, I can run replace to get “Oren and Jim were there. Oren and Alice have bicycles. Jim, Jeff, and Carol play basketball.”
With current functionality, to achieve the same, I have to get whole text
document.getText() and then implement the logic