CodeClerks

How to use regular expressions in AppleScript?



Enter a reason for deleting this comment

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