Can I replace characters in AppleScript?
There are two approaches to solving this problem. One is to use JavaScript for Automation (either by putting your AppleScript into an Automator workflow and then using a separate Run JavaScript action, or by re-writing the entire script in JXA), while the other is to use the sed and cut command line utilities via do shell script.

Here's the JavaScript approach:

var string = "SMBHome: \\\\server\\share\\username" // this would be your 'homepath' variable
var corrected = string.replace(/\\/g, '/').replace('SMBHome: ', '')


This script uses the built-in JavaScript replace function to match and replace text using Regular Expressions.

On the other hand, you could also use sed and cut in your AppleScript, like so:

set init to do shell script "echo ' " &amp; homepath &amp; "' | sed 's/\\\\/\\//g'"
set corrected to do shell script "echo " &amp; init &amp; " | cut -c 10-"


This uses sed for the RegEx, then cut to trim the first bit of the path from the string.

In both cases, the corrected variable contains the final, modified string. I should note that, while the desired behavior can be accomplished in pure AppleScript, it can be rather tedious.