Re: zeroing in on a string inside quotes
Re: zeroing in on a string inside quotes
- Subject: Re: zeroing in on a string inside quotes
- From: "Marc K. Myers" <email@hidden>
- Date: Thu, 29 Nov 2001 01:50:03 -0500
- Organization: [very little]
>
From: email@hidden
>
Date: Wed, 28 Nov 2001 18:29:51 EST
>
Subject: zeroing in on a string inside quotes
>
To: email@hidden
>
>
I've got a string in an AppleScript variable that I've parsed from a
>
web-page. It looks like this:
>
>
<input type=hidden id="UserId" name="UserId" value="swordfish">
>
>
If I wan't to zero in on the word inside the quotes, after the "value=", and
>
put it in a variable, how could I best do that in AppleScript? My Macromedia
>
Director Lingo experience is getting in my way on this string-parsing logic.
>
I'd use some combination of "strpos" and searching for quotes, right?
set theText to "input type=hidden id=\"UserId\" name=\"UserId\"
value=\"swordfish\""
set theQt to ASCII character 34
set {od, AppleScript's text item delimiters} to [optn-L]
{AppleScript's text item delimiters, {theQt}}
set theText to text items of theText
set AppleScript's text item delimiters to od
set innerList to {}
repeat with i from 2 to (count theText) by 2
set innerList to innerList & (item i of theText)
end repeat
item 3 of innerList
-->"swordfish"
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[11/29/01 1:49:16 AM]