For Find & Replace Mavins: Is there a way to increment a number in a replace operation. What I am trying to do is find all instances of a pattern, say "bug". This is easy enough to do with a find operation. I wish to replace each instance of the word "bug" by tagging it with which instance it is. Thus, for the 1st match, "bug" is replaced by "bug1" the second match is replaced by "bug2" and so on. Then I could use replace all & run this & it would be done in a jiffy. Does anyone know if this is possible & what magic might make it happen? Is it possible to do this with a regex?
Ronald B. Kopelman
Find and Replace
Moderators: Eyal Redler, redlers, Ori Redler
Re: Find and Replace
This is a nice question, and
this is how you can do it:
1. Create a new Auto-title and name it “Incremental Number”
2. The value must be Level#
3. Enter “bug” in the Find box and “Found Expression” in the Replace box. Then click on the down-arrow on the left side of the Replace box and select “Insert Auto-title”
4. You will see this
5. Choose “Incremental Number” from the dropdown-menu.
6. The Replace box should now look like this:
7. Click “Replace All” and you should instantly get something like this; I used a red color so the parts that were replaced stand out:
this is how you can do it:
1. Create a new Auto-title and name it “Incremental Number”
2. The value must be Level#
3. Enter “bug” in the Find box and “Found Expression” in the Replace box. Then click on the down-arrow on the left side of the Replace box and select “Insert Auto-title”
4. You will see this
5. Choose “Incremental Number” from the dropdown-menu.
6. The Replace box should now look like this:
7. Click “Replace All” and you should instantly get something like this; I used a red color so the parts that were replaced stand out:
Last edited by Icelander on Sun Jul 21, 2024 7:48 pm, edited 2 times in total.
-
- New to all this
- Posts: 3
- Joined: Fri Jan 26, 2018 12:50 am
Re: Find and Replace
Icelander: Thank you! I will try this. I never would have thought of this. It will come in very handy!