Jump to content
UBot Underground

Recommended Posts

More of a tutorial than a trick or tip, I thought I'd post what I've learned about the ever-confusing $replace function here for others to find...

 

You have to think of replace as having FOUR inputs, not just the three you see when you open it. The fourth is found just before you open the replace window, the actual thing you are replacing. Sometimes you need it to be the same as the first setting (original) and sometimes it shouldn't be... Depending on your needs at the time.

 

If you're modifying your source information itself during the replacement, then it will be the exact same as your 'Original' value, in the first field. If you want to replace a source with something totally unrelated, say, the openeing words from the declaration of independence, then your source would be a totally different variable from your 'Original' variable.

 

The "search" and "replace" are just modifying the "original" value, not the source value. So to sum it up, the:

 

1. Source is usually a variable that exists where you want the new thing to be.

 

2. Original is either that same variable or another if you want to pull in some other content entirely,

 

3. Search is the specific text/code you're looking to replace inside 'original', and

 

4. Replace is just what you want to go there... Usually a variable or the $nothing function, in the case you just want to delete all instances of something.

 

Hope that helps!

Luke

  • Like 1
Link to post
Share on other sites
  • 8 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...