Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Change color of Find/Replace

Featured Replies

From within a script, I would like to find all the instances of a certain word (defined with a variable $curWord) within a field and change their font color to blue.

I have tried "Perform Find/Replace", "Substitute", and a combination of "LeftWords" & "MiddleWords" & "RightWords".

Each of these methods comes with its own downfalls. "LeftWords()" sometimes eats punctuation. "Substitute" replaces WITHIN other words instead of just whole words. "Find/Replace" won't seem to change the color of the found word.

Any suggestions or pointers to where I have gone wrong?

Thank you all for any help you can provide. :P

Nancy

Edited by Guest

Hi

you don't need a script to make what you wish...

For example, we have 2 text fields:

1)"what" where we'll put the word to search

2)"text" ( an [color:red]Auto-Enter/Replace field) where there is the text, with option to auto-enter this calc:

[color:blue]Let([

adjustedText = "|" & Substitute ( TextColorRemove ( text ) ; " "; "|" ) & "|";

search = "|" & what & "|"

];

Trim (

Substitute (

Substitute ( adjustedText ; search; TextColor ( search ; RGB ( 0 ; 0 ; 255 ) ) ) ;

"|" ; " " )

)

)

Note that the resul is "case sensitive", so if you'll search for "New", the word "new" will never change its color.

Also, if the "what" field is turned to empty, the text becames black ! ( or whatever color it was before )

BTW: if you really want to use a script, the same calc is all you need to insert into a Set Field script step.

  • Author

Daniele,

Thank you very much for your help.

What I ended up doing was using a "Find/Replace" script step to append 'xxx' onto each word I needed to change the color of. THEN I used the "Substitute" script step to change the color.

Kind of a kludge, but it did the job. :P-)

Nancy

Ok.

But what you have made is something like this calc:

Let([

search = what & "xxx";

adjustedText = Substitute ( TextColorRemove ( text ) ; what; search)

];

Substitute ( adjustedText ; search; TextColor ( what ; RGB ( 0 ; 0 ; 255 ) ) )

)

This will find also [color:red]portions of a word and you said:

""Substitute" replaces WITHIN other words instead of just whole words. "

Try to search for "[color:red]on" in your text !

You'll have "[color:blue]on", functi"[color:blue]on" , calculati"[color:blue]on"s and so "[color:blue]on" !

So it's better to put "something" where there was a space and the same "something" before the text and at the end of the text.

I did it with " | ", but "xxx" is the same.

EDIT: if the Perform Find/Replace script step is setted to "match whole words only" you had found the correct way :P

Edited by Guest

I got this from Ray Cologons web site, Night Wing Enterprises. It may have some features you are looking for. [color:blue]Auto Bold

HTH

Al

[color:blue]It is suggested that you provide a link to a file which is presented on someone's website rather than attaching their files. In this way, the author can update his file without worrying about another copy attached elsewhere. And it draws people to their website which, in a small way, repays them for providing us with knock-out demos. [color:blue]LaRetta :P-)

Edited by Guest
Removed demo and attached link to NightWing file.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.