I have a document which contains a lot of 5 digits codes (like: 65432, 45334, 88972, etc.) - I need to find a way to add a 3 letters prefix to all these codes (to obtain something like: REF65432, REF45334, REF88972, etc.). Is it better to use GREP find/substitute function or Extend Script? Could anyone suggest me which kind of expression should I use?
What version? For CS3, you can use Find & Replace (in Grep mode).
The codes '\<' and '\>' mark beginning and end of a word, so it doesn't accidentally picks up longer strings. Each '\d' stands for 'any digit'.
In the replace field, 'REF' is regular text, and '$0' is "the found expression", i.e., what gets selected if you press 'Find'.
Thank you jongware; yes I use CS3 and your search/replace expression worked perfectly -
To rhariharasudhan05: I tried also using your script, but it tells me that str is not defined..
Anyway, thank you so much