Clipboard and AppleScript

Quick Note: I use Text Expander to run most of my scripts

There are a few things I want to do. Possibly modifying this script to do what I want.

tell application “Safari”
set selectedText to (do JavaScript “(‘’+getSelection())” in document 1)
end tell

Things I want:
Example(Just using “Email” as an example")

Name: John Doe
User ID: 1111111111

Result:
Email: John Doe
User ID: 1111111111

Using the above script I highlight, it copies but let’s say I want to replace “Name” with “email”. How could I do this?

OR even better
I run a script that finds the information I need in a webpage and puts it in clipboard or auto pastes it using text expander

Want it to find “Name” replace it with “Email:” and then copies the characters after it for said name, ditto for “User ID”. Because the name and ID will always change.

Thank you for any help I get! Thanks. Completely new to making scripts. :slight_smile:

You need some good subroutines. Try the following to replace “Name:” with “Email:”
http://applescript.bratis-lover.net/library/string/#replaceString