Please forgive me if this question is in the wrong place.
Part of the process i'm trying to accomplish is this:
- a text file has various pieces of text that need to be replaced
- what needs changed is in bold.
; Record 5509
@C ENDDOC# RI-P-00074674
@C PGCount 1
; Record 7882
@C ENDDOC# RI-P-00081423
@C PGCount 2
The path is what I'm trying to replace. Occasionally, the path will increment from anywhere from 001 to 045.
The replacement string is @I\VOL001\package_images\ for all paths.
I feed it a file with the above data.
browses for the original location to grab a list of the directories (part of the path)
Attempting to loop thru the output of the text file to find any of the directory name occurrences and replace them with the final path.
Three attempts have not been so successful.
So far so good for:
- the text file that I feed it
- grabbing the directory names and building the list to loop with.
Not good so far:
- finding / repalcing the instances of the directory names in one pass.
- limiting the amount of time it takes to process
Any assistance would be greatly appreciative.
Sounds like a good job for Regular Expressions. You should be able to use sub-expressions to match on your 001-045. Check out ReReplaceNoCase() - I think it will accomplish what you are trying to do.