• 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: Select Finder items by Regular Expression
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Select Finder items by Regular Expression


  • Subject: Re: Select Finder items by Regular Expression
  • From: Daniel Jalkut <email@hidden>
  • Date: Wed, 24 Aug 2005 13:23:07 -0400

On Aug 24, 2005, at 1:07 PM, Michelle Steiner wrote:

On Aug 24, 2005, at 9:57 AM, Daniel Jalkut wrote:

Have you ever wished you could easily select a bunch of items in the Finder by regular _expression_?  You're looking at a huge directory full of files and you want to select all the items whose name end in ".jpg" and contain "Fun"?

This can be done with vanilla Applescript.

tell application "Finder"
    files of entire contents of startup disk whose name contains "Fun" and name extension is "jpg"
end tell

Hi Michelle - I didn't realize that the Finder's built-in matching was as quick and relatively useful as it is. Thanks for that! 

But the big advantage of being able to search by regular _expression_ is that you don't have to write the script every time. You just have to write the _expression_.  I'm not as likely to take the time to write a complete script for a one-off operation like this.

Also, regular expressions make it easy to express more complicated queries like "ends in jpg or jpeg and contain a series of three capital letters followed by a numeral." I'm almost positive you can't put that into words that AppleScript can easily understand.

By the way, a regex for that is "[A-Z]{3}[0-9]{1}.*jpg|jpeg"

Daniel

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Select Finder items by Regular Expression
      • From: Michelle Steiner <email@hidden>
References: 
 >Select Finder items by Regular Expression (From: Daniel Jalkut <email@hidden>)
 >Re: Select Finder items by Regular Expression (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Obvious bug still in Tiger since original version
  • Next by Date: Re: Folder action to rename files
  • Previous by thread: Re: Select Finder items by Regular Expression
  • Next by thread: Re: Select Finder items by Regular Expression
  • Index(es):
    • Date
    • Thread