Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5384 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

In a block of text, I'd like to use substitute to swap out every other occurrence of a text string, or every one within the paragraph except the first. Ideally, I'd like to vary by number of occurrences (every [fourth] is unchanged). Are any of these possible?

Example

Google stock is through the roof. Will Google exceed all expectations? How high do you think Google will go? Go, Google!

could become

Google stock is through the roof. Will GOOG exceed all expectations? How high do you think GOOG will go? Go, Google!

Posted

To substitute all but the first occurrence of searchString:


Let ( [

split = Position ( text ; searchString ; 1 ; 1 ) + Length ( searchString )

] ;

Left ( text ; split ) & Substitute ( Right ( text ; Length ( text ) - split ) ; searchString ; replaceString )

)

To replace (or not) every n-th occurrence, you will need a custom (recursive) function.

Posted

Note that the Substitute() function is case sensitive so SearchString in Comment's calculation must be Google and not google.

This topic is 5384 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.