CodeClerks

How to use regular expressions in AppleScript?



Write the reason you're deleting this FAQ

How to use regular expressions in AppleScript?

Does anyone know how to use regular expressions (regex) in AppleScript? I have the following code and need to get a url from the page source in AppleScript only, I can't use ~do JavaScript "javascript"~ because I'm not telling it to load the page in Safari .


setbase_url to "http://www.example.com"
set page_url to "/login"
set cookie_file to "/Users/username/Desktop/cookie.txt"

-- //

set opt_cookie to " --cookie '" & cookie_file & "'"

-- //

set LoginPage_Data to do shell script "curl -k -L " & base_url & page_url & opt_cookie

-- some regex to get url from "LoginPage_Data"
 


~Jake

Comments

Please login or sign up to leave a comment

Join