On Oct 30, 2016, at 12:54, Vlad Ghitulescu <[email protected] 
<mailto:[email protected]>> wrote:
>> BBEdit does not allow mass editing of multiple highlighted instances of text 
>> (although I think this feature is in the pipeline somewhere).
> 
> Is it?


Hey Vlad,

No bets, but it seems like a logical progression of highlight-all and is a 
common feature of most excellent text editors these days.  I suspect there are 
technical hurdles, or we would have the feature already.

But I'm just guessing.

> Any chance to extend the text filter with my 4th delete:

Try this:

#!/usr/bin/env perl -0777 -nsw
s! *\(Viewed\) *(?=[\n\r])!!ig;
s!\nVideo *! !ig;
s!^Save \w.+[\n\r]!!gm;
print;

You should be close to being able to modify this for your own purposes by now.

The canonical method of writing a search/replace in Perl is thus:

s/<search-pattern/<replace-pattern/<flags>;

But you can replace the forward-slashes with many different symbol characters 
for flexibility and clarity.

I like to use the exclamation point myself.

So...

s!<search-pattern>!<replace-pattern>!<flags>;

The most common flags:

g  ==  Match globally, i.e. find all occurrences
i  ==  Case-insensitive
m  ==  Treat string as multiple lines
s  ==  Treat string as single line. (Make . match a newline)

While Perl ordinarily operates on text on a per-line basis, I've used some 
tricks to make each search/replace line operate on the entire text in the 
script above.

So take this simple case and experiment with various regular expressions.

#!/usr/bin/env perl -0777 -nsw
s!seach!replace!ig;
print;

* Note that statements in Perl must be terminated with a semi-colon.


--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to