• 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: looking to correct Smiles measuretext command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: looking to correct Smiles measuretext command


  • Subject: Re: looking to correct Smiles measuretext command
  • From: Thomas Fischer <email@hidden>
  • Date: Sun, 26 Jun 2011 08:31:46 +0200

Hi Robert,

This makes no sense to me, see examples below.

set foundString to fnd("[\s]+", str, true, true, true) -->error

You need to escape the backslash,

set foundString to fnd("[\\s]+", str, true, true, true)

will work (else AppleScript is looking for a special character \s, like \n or \").

set str to "Your Broadband2Go Account Number and Programming Instructions"
-- set foundString to fnd("[A-Z0-9space]+", str, true, true, true) --> 15 - should be 18

In this case, "space" is just a collection of five characters, as you see in the result:

{"Y", "B", "a", "a", "2G", "Acc", "N", "e", "a", "P", "a", "I", "s", "c", "s"}

-- set foundString to fnd("[A-Z0-9]+", str, true, true, true) --> 7 - should be 9

The result is  {"Y", "B", "2G", "A", "N", "P", "I"}, why would you expect 9?

-- set foundString to fnd("[[A-Z],[0-9]]+", str, true, true, true) --> 7 - should be 9

Again, the result is {"Y", "B", "2G", "A", "N", "P", "I"}. I'm not sure how double brackets are to be interpreted.

set foundString to fnd("[NA ]+", str, true, true, true) --> 6 - should be 18

This yields {" ", " A", " N", " ", " ", " "}. What did you expect?

All the best
Thomas

 _______________________________________________
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

References: 
 >looking to correct Smiles measuretext command (From: Robert Poland <email@hidden>)
 >Re: looking to correct Smiles measuretext command (From: Christopher Stone <email@hidden>)
 >Re: looking to correct Smiles measuretext command (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: looking to correct Smiles measuretext command
  • Next by Date: Re: looking to correct Smiles measuretext command
  • Previous by thread: Re: looking to correct Smiles measuretext command
  • Next by thread: Re: looking to correct Smiles measuretext command
  • Index(es):
    • Date
    • Thread