[AccessD] Searching for and replacing text in a string

rusty.hammond at cpiqpc.com rusty.hammond at cpiqpc.com
Mon Apr 7 11:02:53 CDT 2003


I have a project where I pull in a text file, search for certain strings and
replace them with another string.  I have a table of the SearchFor and
ReplaceWith strings so if anything changes in the codes they use they just
have to adjust the entry in a table.  I load the entire contents of the file
into a string variable then search that variable for occurrences of the
string to replace.  So far everything works great, but now they need to
search for a date in a certain area of the file and replace it with a code.
Problem is the date will change each time they run this on a new file.  I
could have them change the SearchFor string each time they run this, but
since the date will always be next to certain static characters it would be
nice to utilize wildcard characters in the searchfor string ie SearchFor
"~~GA~????????" (where the ?'s represent a date in mmddyyyy format) and the
ReplaceWith string would simply be "~~GA~XX".

Does anyone have a function that would do this?  It would need to search for
strings with or without wildcard characters.

MTIA

Rusty


More information about the AccessD mailing list