• 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: Regex in OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regex in OS X


  • Subject: Re: Regex in OS X
  • From: BJ Terry <email@hidden>
  • Date: Fri, 6 Feb 2004 14:04:48 -0800

It seems that in principle the only thing you need to do is construct an extremely simple regex string, then use one of the many utilities to use it. The regex string would simply be: "^" and the string you're searching for and ".*". This would then be directly useable in either Satimage's osax as

find text "^Macdonalds.*" in "Macdonalds MacDonalds\ndog" with regexp

This matches the line "Macdonalds MacDonalds" as Satimage's osax defaults to a "dot doesn't match newline" mode. One could also use this in a do shell script:

do shell script "grep \"^Macdonalds\" /path/to/file"

returns every line of the file which begins with Macdonalds. The .* is necessary in Satimage to capture the whole line, but grep defaults to printing the whole line on a match, so it isn't necessary.

BJ
_______________________________________________
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.

  • Follow-Ups:
    • Re: Regex in OS X
      • From: Emmanuel <email@hidden>
References: 
 >Regex in OS X (From: Hanaan Rosenthal <email@hidden>)

  • Prev by Date: Re: Regex in OS X
  • Next by Date: Re: Regex in OS X
  • Previous by thread: Re: Regex in OS X
  • Next by thread: Re: Regex in OS X
  • Index(es):
    • Date
    • Thread