Any suggestion please..
You're looking for 'figure ' followed by any digit. You should look for 'figure ' followed by a specific digit (if I understand you correctly).
Thanks for your reply. Am looking figure followed by my input digit.
Example figure 5.1 change to figure 1.1.
Old chapter box my input is 5
New chapter box my input is 1
If click OK button it will be change to figure 1.1
Above code changed figure 5.1 to figure 1.1 and also See figure 15.1 changed figure 11.1
Again, you're matching 'figure ' followed by any number.
Why the loop, by the way? You can do this:
app.findGrepPreferences = app.changeGrepPreferences = null; app.findGrepPreferences.findWhat = "(?i)figure\\s\\K" + Old_Chapters.text; app.findGrepPreferences.changeTo = New_Chapter.text; mFind=myDoc.changeGrep();
(?i) means 'search case-insensitively
\K denotes a lookbehind
Thanks for your help. I worked with your script it's changes,
Figure 5.1 to 1.1
figure 5.1 to 1.1
Figure 15.1 not changed