Find/replace text in string w/o text editor...possible?

OK, trying to find out if I can encapsulate something into a single script & app. What I need is something to go through a list of email addresses stored in a non-Filemaker (NOW Contact) db and replace any “-” or “&” characters with “@”. I can easily grab the whole text of the field and store it as a var in my script, but the question is: can I manipulate it there? Is there a way to replace the text in the variable string w/o doing something “drastic” such as pasting into a text editor, doing a find & replace, and returning the result? Thanks in advance for any leads here!

Here’s a lead: applescript text item delimiters.

And here’s an example. If you need help putting this into a repeat loop to go through all of your addresses, let us know. :slight_smile:

set address_ to "somescripter&macscripter.net"
set replaceWith to "@"
set badCharacters to {"-", "&"}

repeat with thisChar in badCharacters
	try
		set AppleScript's text item delimiters to thisChar
		set fixinIt to text items of address_
		set AppleScript's text item delimiters to replaceWith
		set fixed_ to fixinIt as string
		set AppleScript's text item delimiters to {""}
	on error
		set AppleScript's text item delimiters to {""}
	end try
	set address_ to fixed_
end repeat
display dialog address_