• 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: Get text between two substrings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get text between two substrings


  • Subject: Re: Get text between two substrings
  • From: Joseph Weaks <email@hidden>
  • Date: Thu, 30 Jun 2005 03:27:44 -0500


On Jun 30, 2005, at 3:11 AM, Gary (Lists) wrote:

"Joseph Weaks" wrote:

Given a string, what is a good do shell script one-liner to grab the
text in between two sub-strings?

A non-optimized, format-dependent, not very robust PCRE [Perl-compatible
reg-ex] (tested in TextWrangler) to grab an HTML comment could be:


Find:     >([^<]*)!
Replace:  \1

No no no no... sorry. I shouldn't have confused the issue by using tags in the example. I want to pull the text that falls between to random types of strings. Use this example:


set theString to "Foo I'm all that remains Bar"

set newString to do shell script "echo '" & theString & "' | perl something 'Foo' something 'bar';print"

That clearer?

_______________________________________________
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: Get text between two substrings
      • From: "Gary (Lists)" <email@hidden>
References: 
 >Re: Get text between two substrings (From: "Gary (Lists)" <email@hidden>)

  • Prev by Date: Re: path to as string
  • Next by Date: Re: "read from" and non-lo-ascii characters
  • Previous by thread: Re: Get text between two substrings
  • Next by thread: Re: Get text between two substrings
  • Index(es):
    • Date
    • Thread