Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search and Replace
#1
I have been trying to create a macro that will search for a string, replace it with another string and count how many were replace. The documents are in txt format, so can be opened in Notepad.

I have searched the forum and couldn't find an example. Please help!

Thanks!!!
#2
If the string where you want to search is in a variable, use str function findreplace() or replacerx(). Both return the number of found/replaced strings.

If you want to search and replace in a window (eg in Notepad), you can use Replace() function.

Macro
Trigger F11     Help - how to add the trigger to the macro
Code:
Copy      Help
;Replace every occurence of "Mart" to "April" in selected
;text. Find whole words, case insensitive:
int n=Replace("Mart" "April" 0 1 1)
mes "replaced %i substrings" "" "i" n


Forum Jump:


Users browsing this thread: 1 Guest(s)