Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Scrolling files open in "Currently Open Documents"
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  24 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Aman  
View profile  
 More options Sep 22 2011, 11:36 pm
From: Aman <reporta...@gmail.com>
Date: Thu, 22 Sep 2011 20:36:54 -0700 (PDT)
Local: Thurs, Sep 22 2011 11:36 pm
Subject: Scrolling files open in "Currently Open Documents"
Hi,

When i position the mouse pointer in the editor window and use three
finger scroll on trackpad the windows scroll quite haphazardly,
probably based on update time.. Is there a setting to allow scrolling
in the order the files are listed in the "Currently open Documents"
pane.

Regards,

Aman


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Repeating a Grep Search Until It Fails" by Rick Gordon
Rick Gordon  
View profile  
 More options Sep 24 2011, 4:03 am
From: Rick Gordon <li...@rickgordon.com>
Date: Sat, 24 Sep 2011 01:03:15 -0700
Local: Sat, Sep 24 2011 4:03 am
Subject: Repeating a Grep Search Until It Fails
How can I set up a grep search that will repeat looping through the document until all instances have been processed?

For instance, say I've set up markers (« and ») around target source strings, and want to process thos strings to remove any characters that are not ASCII, numeric, space, or hyphen. Something like:

FIND:
        (?<=«)(.*?)[^- A-Za-z0-9«»]+?(.*?)(?=»)

CHANGE TO:
        \1\2

How can I keep it looping until no more instances are found?

--
___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

WWW:   http://www.shelterpub.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marek Stepanek  
View profile  
 More options Sep 24 2011, 8:16 am
From: Marek Stepanek <ms...@podiuminternational.org>
Date: Sat, 24 Sep 2011 14:16:23 +0200
Local: Sat, Sep 24 2011 8:16 am
Subject: Re: Repeating a Grep Search Until It Fails
On 05.01.2011 10:03 AM, Rick Gordon wrote:

> How can I set up a grep search that will repeat looping through the document until all instances have been processed?

> For instance, say I've set up markers (« and ») around target source strings, and want to process thos strings to remove any characters that are not ASCII, numeric, space, or hyphen. Something like:

> FIND:
>    (?<=«)(.*?)[^- A-Za-z0-9«»]+?(.*?)(?=»)

> CHANGE TO:
>    \1\2

> How can I keep it looping until no more instances are found?

I don't like the find and replace dialogue any more, which was changed a
long while ago. First go on top of your open file (this is tricky and
annoying, because we have had once a button: "search backwards" etc I
never understood, why BareBones removed this). Enter your search
patterns, enable grep, and click on "replace & find".

marek

--
___________________________________________

         the embassy for talented young musicians
    Podium International | Marek Stepanek | ms...@PodiumInternational.org
         http://www.PodiumInternational.org
             ___________________________________________


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bucky Junior  
View profile  
 More options Sep 24 2011, 10:03 am
From: Bucky Junior <buckyjunior...@googlemail.com>
Date: Sat, 24 Sep 2011 08:03:01 -0600
Local: Sat, Sep 24 2011 10:03 am
Subject: Re: Repeating a Grep Search Until It Fails
Do you mean something like "Replace All"? The default keys are Option-Command-R.

Sometimes I want to make select changes but not all so I use command-G
to skip changing and find the next occurrence and command-T to make
the change and find the next.

Bucky

On Sat, Sep 24, 2011 at 6:16 AM, Marek Stepanek


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick Gordon  
View profile  
 More options Sep 24 2011, 3:21 pm
From: Rick Gordon <li...@rickgordon.com>
Date: Sat, 24 Sep 2011 12:21:25 -0700
Local: Sat, Sep 24 2011 3:21 pm
Subject: Re: Repeating a Grep Search Until It Fails
Replace All is not doing it. I need to click Replace All many times to complete this sort of search. I think that the (?R) recursive search indication might help, but I can't figure out its general syntax from the single example in the BBEdit manual.

------------------

On 9/24/11 at 8:03 AM -0600, Bucky Junior wrote in a message entitled
"Re: Repeating a Grep Search Until It Fails":

--
___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

WWW:   http://www.shelterpub.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ronald J Kimball  
View profile  
 More options Sep 24 2011, 4:33 pm
From: Ronald J Kimball <r...@tamias.net>
Date: Sat, 24 Sep 2011 16:33:33 -0400
Local: Sat, Sep 24 2011 4:33 pm
Subject: Re: Repeating a Grep Search Until It Fails

On Sat, Sep 24, 2011 at 01:03:15AM -0700, Rick Gordon wrote:
> How can I set up a grep search that will repeat looping through the document until all instances have been processed?

> For instance, say I've set up markers ( and ) around target source strings, and want to process thos strings to remove any characters that are not ASCII, numeric, space, or hyphen. Something like:

> FIND:
>    (?<= )(.*?)[^- A-Za-z0-9 ]+?(.*?)(?= )

> CHANGE TO:
>    \1\2

> How can I keep it looping until no more instances are found?

As you've found, you can't do a loop inside a loop with a single grep.
Instead of repeating the grep manually until no matches are found, I would
use a Unix Filter.  Here's a Perl script that does it:

#!perl -p

s{( )([^ ]+)( )}{my $x = $2; $x =~ tr,A-Za-z0-9 -,,cd; "$1$x$3"}ge;

__END__

This matches each occurence of ... , and then removes the unwanted
characters within each match.

Ronald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Delacour  
View profile  
 More options Sep 24 2011, 6:11 pm
From: John Delacour <johndelac...@gmail.com>
Date: Sat, 24 Sep 2011 23:11:10 +0100
Local: Sat, Sep 24 2011 6:11 pm
Subject: Re: Repeating a Grep Search Until It Fails
At 16:33 -0400 24/9/11, Ronald J Kimball wrote:

>.. Here's a Perl script that does it:

>#!perl -p

>s{(«)([^»]+)(»)}{my $x = $2; $x =~ tr,A-Za-z0-9 -,,cd; "$1$x$3"}ge;

>__END__

It works with this:

one «abç» two «abc∂» three «aßcdé»

but not with this:

one «a®bc» two «abc®™» three «®®a»

and the eval might make it fail on a server.

JD


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Delacour  
View profile   Translate to Translated (View Original)
 More options Sep 24 2011, 7:34 pm
From: John Delacour <johndelac...@gmail.com>
Date: Sun, 25 Sep 2011 00:34:20 +0100
Local: Sat, Sep 24 2011 7:34 pm
Subject: Re: Repeating a Grep Search Until It Fails
At 01:03 -0700 24/9/11, Rick Gordon wrote:

>How can I set up a grep search that will repeat looping through the
>document until all instances have been processed?

>For instance, say I've set up markers (« and ») around target
>source strings, and want to process thos strings to remove any
>characters that are not ASCII, numeric, space, or hyphen. Something
>like:

>FIND:
>    (?<=«)(.*?)[^- A-Za-z0-9«»]+?(.*?)(?=»)

>CHANGE TO:
>    \1\2

>How can I keep it looping until no more instances are found?

The following Text Filter will, so far as I can tell, do the job.  I
have even tried putting Chinese characters withing the guillemets.
It's probably far more longwinded than it needs to be but it works.

#!/usr/local/bin/perl
use strict;
use encoding 'utf-8';
my $inside;
while (<>) {
   my @chars = split //;
   for (@chars) {
     my $ord = ord;
     $inside = 1 if $ord == 171;
     $inside = 0 if $ord == 187;
     if ($inside) {
       print if $ord == 171;
       print if /[a-z]|[0-9]| |-/i;
     } else {
       print;
     }
   }

}

__END__

JD


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ronald J Kimball  
View profile  
 More options Sep 24 2011, 7:38 pm
From: Ronald J Kimball <r...@tamias.net>
Date: Sat, 24 Sep 2011 19:38:08 -0400
Local: Sat, Sep 24 2011 7:38 pm
Subject: Re: Repeating a Grep Search Until It Fails

Unicode can be such a pain...  Not my area of expertise, unfortunately.  I
haven't figured out yet how to fix the filter.  Anyone else know the magic
combination of pragmas and encodings?

> and the eval might make it fail on a server.

I'm not sure why you think that.

Ronald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Delacour  
View profile  
 More options Sep 24 2011, 7:39 pm
From: John Delacour <johndelac...@gmail.com>
Date: Sun, 25 Sep 2011 00:39:11 +0100
Local: Sat, Sep 24 2011 7:39 pm
Subject: Re: Repeating a Grep Search Until It Fails
At 00:34 +0100 25/9/11, John Delacour wrote:

>#!/usr/local/bin/perl...

Sorry!  That should probably be

#!/usr/bin/perl

on most people's systems.

JD


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charlie Garrison  
View profile  
 More options Sep 24 2011, 7:52 pm
From: Charlie Garrison <garri...@zeta.org.au>
Date: Sun, 25 Sep 2011 09:52:21 +1000
Local: Sat, Sep 24 2011 7:52 pm
Subject: Re: Repeating a Grep Search Until It Fails
Good morning,

On 24/09/11 at 7:38 PM -0400, Ronald J Kimball <r...@tamias.net> wrote:

>Unicode can be such a pain...  Not my area of expertise, unfortunately.  I
>haven't figured out yet how to fix the filter.  Anyone else know the magic
>combination of pragmas and encodings?

Try:

use utf8;

That tells Perl that the script itself (as opposed to input/output) is UTF8.

Charlie

--
   Ꮚ Charlie Garrison ♊ <garri...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charlie Garrison  
View profile  
 More options Sep 24 2011, 7:52 pm
From: Charlie Garrison <garri...@zeta.org.au>
Date: Sun, 25 Sep 2011 09:52:21 +1000
Local: Sat, Sep 24 2011 7:52 pm
Subject: Re: Repeating a Grep Search Until It Fails
Good morning,

On 25/09/11 at 12:39 AM +0100, John Delacour

<johndelac...@gmail.com> wrote:
>At 00:34 +0100 25/9/11, John Delacour wrote:

>>#!/usr/local/bin/perl...

>Sorry!  That should probably be

>#!/usr/bin/perl

>on most people's systems.

Or make it more generic;

#!/usr/bin/env perl

That will use the first perl found in $PATH.

And if you're not using the system-supplied perl, I suggest
having a look at perlbrew. I also suggest not using the
system-supplied perl, which implies my perlbrew suggestion.

Charlie

--
    Ꮚ Charlie Garrison ♊ <garri...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ronald J Kimball  
View profile  
 More options Sep 24 2011, 7:54 pm
From: Ronald J Kimball <r...@tamias.net>
Date: Sat, 24 Sep 2011 19:54:16 -0400
Local: Sat, Sep 24 2011 7:54 pm
Subject: Re: Repeating a Grep Search Until It Fails

When I run this filter on your sample text, I get the following result:

http://gyazo.com/5bc49629f7d4b0faf663634585fd6355.png

What am I doing wrong?

thanks,
Ronald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charlie Garrison  
View profile  
 More options Sep 24 2011, 8:13 pm
From: Charlie Garrison <garri...@zeta.org.au>
Date: Sun, 25 Sep 2011 10:13:25 +1000
Local: Sat, Sep 24 2011 8:13 pm
Subject: Re: Repeating a Grep Search Until It Fails
Good morning,

On 24/09/11 at 7:54 PM -0400, Ronald J Kimball <r...@tamias.net> wrote:

>When I run this filter on your sample text, I get the following result:

>http://gyazo.com/5bc49629f7d4b0faf663634585fd6355.png

>What am I doing wrong?

Rather than:

use encoding 'utf-8';

Try:

use encoding 'utf8';

It could be that 'utf-8' is an alias for 'utf8', so may not make
any difference, but 'utf8' is the correct value.

See `perldoc encoding` for all the gory details.

Charlie

PS. I can never keep clear whether to use utf8 or utf-8, so if
one doesn't work, try the other.
--
    Ꮚ Charlie Garrison ♊ <garri...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ronald J Kimball  
View profile  
 More options Sep 24 2011, 8:21 pm
From: Ronald J Kimball <r...@tamias.net>
Date: Sat, 24 Sep 2011 20:21:37 -0400
Local: Sat, Sep 24 2011 8:21 pm
Subject: Re: Repeating a Grep Search Until It Fails

On Sun, Sep 25, 2011 at 10:13:25AM +1000, Charlie Garrison wrote:
> Rather than:

> use encoding 'utf-8';

> Try:

> use encoding 'utf8';

> It could be that 'utf-8' is an alias for 'utf8', so may not make
> any difference, but 'utf8' is the correct value.

I get the same result, unfortunately.  I don't know if this is a problem
with the script, or with the passing of data between the script and BBEdit.

Ronald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Delacour  
View profile  
 More options Sep 24 2011, 8:24 pm
From: John Delacour <johndelac...@gmail.com>
Date: Sun, 25 Sep 2011 01:24:35 +0100
Local: Sat, Sep 24 2011 8:24 pm
Subject: Re: Repeating a Grep Search Until It Fails
At 19:54 -0400 24/9/11, Ronald J Kimball wrote:

>When I run this filter on your sample text, I get the following result:

>http://gyazo.com/5bc49629f7d4b0faf663634585fd6355.png

>What am I doing wrong?

I'm not sure.  Both the target file and the filter script were
encoded as my default UTF-8 no bom with UNIX linefeeds, but even if I
change the encodings in the files it works fine.  I see roughly what
is happening but it's way past my bedtime and I can't tell you quite
why.  What have you set in Preferences for 'Default text encoding for
new documents'?

JD


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Delacour  
View profile  
 More options Sep 24 2011, 8:20 pm
From: John Delacour <johndelac...@gmail.com>
Date: Sun, 25 Sep 2011 01:20:42 +0100
Local: Sat, Sep 24 2011 8:20 pm
Subject: Re: Repeating a Grep Search Until It Fails
At 09:52 +1000 25/9/11, Charlie Garrison wrote:

>>Sorry!  That should probably be

>>#!/usr/bin/perl

>>on most people's systems.

>Or make it more generic;

>#!/usr/bin/env perl

>That will use the first perl found in $PATH.

In fact for Text Filters #!perl is enough, as I've just discovered
from Ronald Kimball's example, and if the filter has the .pl suffix
(not needed if the shebang is there) then you don't need a shebang at
all, though this may change when Barebones actually admit the
phenomenon.

The shebang is, of course, needed if you need to specify a particular Perl.

At 09:52 +1000 25/9/11, Charlie Garrison wrote:

>Try:

>use utf8;

>That tells Perl that the script itself (as opposed to input/output) is UTF8.

In this case it *is* the input and output that matter.  That's why I
used the line:

        use encoding 'utf-8';

which is essential.  Without it, as you can tell by trying, you get
raw utf-8 bytes.

'use utf8' is very different and usually does nothing at all.

JD


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Delacour  
View profile  
 More options Sep 24 2011, 8:46 pm
From: John Delacour <johndelac...@gmail.com>
Date: Sun, 25 Sep 2011 01:46:04 +0100
Local: Sat, Sep 24 2011 8:46 pm
Subject: Re: Repeating a Grep Search Until It Fails
At 10:13 +1000 25/9/11, Charlie Garrison wrote:

>Rather than:

>use encoding 'utf-8';

>Try:

>use encoding 'utf8';

>It could be that 'utf-8' is an alias for 'utf8', so may not make any
>difference, but 'utf8' is the correct value.

Have you tried it?  It simply does not work, and it is NOT the
correct value.  The name of the charset is utf-8 or UTF-8.  I think
you are confusing this usage with Perl's 'use utf8', which is totally
different.

>See `perldoc encoding` for all the gory details.

Gory maybe, but nowhere does it suggest you should use a charset that
does not exist!

See:

<http://perldoc.perl.org/perlunifaq.html#What%27s-the-difference-betwe...>

<http://perldoc.perl.org/Encode.html#UTF-8-vs.-utf8-vs.-UTF8>

JD


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ronald J Kimball  
View profile  
 More options Sep 24 2011, 9:01 pm
From: Ronald J Kimball <r...@tamias.net>
Date: Sat, 24 Sep 2011 21:01:41 -0400
Local: Sat, Sep 24 2011 9:01 pm
Subject: Re: Repeating a Grep Search Until It Fails

On Sun, Sep 25, 2011 at 01:24:35AM +0100, John Delacour wrote:
> I'm not sure.  Both the target file and the filter script were
> encoded as my default UTF-8 no bom with UNIX linefeeds, but even if I
> change the encodings in the files it works fine.  I see roughly what
> is happening but it's way past my bedtime and I can't tell you quite
> why.  What have you set in Preferences for 'Default text encoding for
> new documents'?

These are my settings for Text Encodings:

  If file's encoding can't be guessed, use: Western (Mac OS Roman)

  Default text encoding for new documents: Unicode (UTF-8)

  Use UTF-8 for unix script I/O is enabled.

Let me know if you have any thoughts after you've had a good night's
sleep.  :)

Ronald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charlie Garrison  
View profile  
 More options Sep 24 2011, 9:08 pm
From: Charlie Garrison <garri...@zeta.org.au>
Date: Sun, 25 Sep 2011 11:08:48 +1000
Local: Sat, Sep 24 2011 9:08 pm
Subject: Re: Repeating a Grep Search Until It Fails
Good morning,

On 25/09/11 at 1:20 AM +0100, John Delacour

I hadn't been following the thread so wasn't sure what the
requirements were. Which is why I said one method was for
setting encoding of the script while other was for encoding of input/output.

Anyway, we're straying off topic.

Charlie

--
    Ꮚ Charlie Garrison ♊ <garri...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charlie Garrison  
View profile  
 More options Sep 24 2011, 9:10 pm
From: Charlie Garrison <garri...@zeta.org.au>
Date: Sun, 25 Sep 2011 11:10:13 +1000
Local: Sat, Sep 24 2011 9:10 pm
Subject: Re: Repeating a Grep Search Until It Fails
Good morning,

On 25/09/11 at 1:46 AM +0100, John Delacour

<johndelac...@gmail.com> wrote:
>>See `perldoc encoding` for all the gory details.

>Gory maybe, but nowhere does it suggest you should use a charset that does not exist!

I was saying that based on one of the examples in the POD, specifically:

   use encoding 'utf8';

I then explicity search for an example using 'utf-8' and
couldn't find one.

So I concluded that utf8 is the correct value.

Which just says that utf8 is a relaxed version of utf-8 (or utf8
vs utf-8-strict).

So both are valid, and no, utf-8 is not just an alias for utf8
as I had guessed. But for the purposes of the text filter,
either should work fine.

Charlie

--
    Ꮚ Charlie Garrison ♊ <garri...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charlie Garrison  
View profile  
 More options Sep 24 2011, 9:10 pm
From: Charlie Garrison <garri...@zeta.org.au>
Date: Sun, 25 Sep 2011 11:10:14 +1000
Local: Sat, Sep 24 2011 9:10 pm
Subject: Re: Repeating a Grep Search Until It Fails
Good morning,

On 25/09/11 at 1:20 AM +0100, John Delacour

<johndelac...@gmail.com> wrote:
>'use utf8' is very different and usually does nothing at all.

Maybe "does nothing at all" if the script itself doesn't contain
unicode characters. If it does, then it certainly does
something, and is quite important.

Charlie

--
    Ꮚ Charlie Garrison ♊ <garri...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick Gordon  
View profile  
 More options Sep 24 2011, 8:22 pm
From: Rick Gordon <li...@rickgordon.com>
Date: Sat, 24 Sep 2011 17:22:56 -0700
Local: Sat, Sep 24 2011 8:22 pm
Subject: Re: Repeating a Grep Search Until It Fails
Thanks for all your suggestions. Will need to brush up on my Perl and check it out.

Also, actually my needs are a little less complex than what is been currently discussed. My idea is to build id names for every h1-h6 in a folder of documents, and my intention was to start with the text of the head, and then munge that down to strip out all punctuation and upper ascii, then replace spaces with hyphens, and then add an "x" in front of any id entries that begin with a digit.

Can anyone confirm the use and syntax of the recursive operator (?R) discussed in advanced grep topics (on p. 194 of the manual that accompanies v9.x).

------------------

On 9/24/11 at 12:21 PM -0700, Rick Gordon wrote in a message entitled
"Re: Repeating a Grep Search Until It Fails":

>Replace All is not doing it. I need to click Replace All many times to complete this sort of search. I think that the (?R) recursive search indication might help, but I can't figure out its general syntax from the single example in the BBEdit manual.

--
___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

WWW:   http://www.shelterpub.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Løseth Tor Rafsol  
View profile  
 More options Sep 28 2011, 3:55 pm
From: Løseth Tor Rafsol <jarnle...@gmail.com>
Date: Wed, 28 Sep 2011 21:55:25 +0200
Local: Wed, Sep 28 2011 3:55 pm
Subject: Re: Repeating a Grep Search Until It Fails

On Sep 24, 2011, at 10:03 AM, Rick Gordon wrote:

> How can I set up a grep search that will repeat looping through the document until all instances have been processed?

> For instance, say I've set up markers (« and ») around target source strings, and want to process thos strings to remove any characters that are not ASCII, numeric, space, or hyphen. Something like:

> FIND:
>    (?<=«)(.*?)[^- A-Za-z0-9«»]+?(.*?)(?=»)

> CHANGE TO:
>    \1\2

> How can I keep it looping until no more instances are found?

This AppleScript loop replaces two carriage returns (\r\r} to one (\r), so just put your search and replace items in their place:

tell application "BBEdit"
        activate
        select text 1 of project window 1
        open find window
        repeat
                replace "\\r\\r" using "\\r" searching in selection of project window 1 options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
        end repeat
end tell

Tor Rafsol Løseth


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »