Re: selective string-replace
Re: selective string-replace
- Subject: Re: selective string-replace
- From: "Marc K. Myers" <email@hidden>
- Date: Wed, 07 Aug 2002 19:42:22 -0400
- Organization: [very little]
>
From: email@hidden
>
Date: Wed, 7 Aug 2002 16:04:54 EDT
>
Subject: selective string-replace
>
To: email@hidden
>
>
I have a need to write a script that will convert strings like this:
>
>
http://progressive.stream.aol.com/newline/gl/newline/lordoftherings/TheTwoTowe
>
>
rs_480.mov
>
http://progressive.stream.aol.com/wbonline/reloaded_teaser_1_480.mov
>
>
into strings like this:
>
>
http://progressive.stream.aol.com|newline|gl|newline|lordoftherings|TheTwoTowe
>
>
rs_480.mov
>
http://progressive.stream.aol.com|wbonline|reloaded_teaser_1_480.mov
>
>
I somehow need to do a "search and replace" of the slashes with pipes, yet
>
leave the http:// slashes intact. Is there a way I can do a stringreplace,
>
yet somehow detect that if there's 2 slashes together, that they should be
>
left untouched?
set theText to "
http://progressive.stream.aol.com/newline/gl/newline/lordoftherings/TheTwoTowe"
set od to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"//"}
set theList to text items of theText
set AppleScript's text item delimiters to {"/"}
set innerList to text items of item 2 of theList
set AppleScript's text item delimiters to {"|"}
set item 2 of theList to (innerList as text)
set AppleScript's text item delimiters to {""}
set theText to (theList as text)
set AppleScript's text item delimiters to od
theText
-->"http:/progressive.stream.aol.com|newline|gl|newline|lordoftherings|TheTwoTowe"
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[8/7/02 7:41:53 PM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.