• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Simple text question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple text question


  • Subject: Re: Simple text question
  • From: "Mark J. Reed" <email@hidden>
  • Date: Mon, 7 Jul 2008 16:54:33 -0400

> the word "[F]" can be any word

... but it has to be in square brackets, right?

> The number can be 1,2,3 or 4 digits long.

There's always brute force:

et a to "gibberish 30[Foobazoo]this is test (#1)."
set final to offset of "]" in a
set found to false
if final is not 0 then
    set initial to final - 1
    repeat while initial > 1 and text initial of a is not "["
        set initial to initial - 1
    end repeat
    if text initial of a is "[" then
       repeat while initial > 1
           set ch to text (initial - 1) of a
           if ch >= "0" and ch <= "9" then
               set found to true
               set initial to initial - 1
           else
               exit repeat
           end if
        end repeat
    end if
    if found then
        return text initial through final of a
    else
        return the missing value
    end
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Simple text question
      • From: Michelle Steiner <email@hidden>
References: 
 >Re: Simple text question (From: Michelle Steiner <email@hidden>)
 >RE: Simple text question (From: "Script2" <email@hidden>)

  • Prev by Date: Re: set understanding to (get explanation)
  • Next by Date: Re: Simple text question
  • Previous by thread: RE: Simple text question
  • Next by thread: Re: Simple text question
  • Index(es):
    • Date
    • Thread