Search and Replace links with different file names

2014-02-27 Thread outtacontext
I need to search for this string and delete all of them in 70 web pages. 
The only problem is that the file names are different as are the link names 
(I've bolded  and made red those the part of the search that will be 
different in every file):

 blockquote
   h3a href=/exhibitions/online/roby/*xxx*.cfm*XXX* /a/h3
 /blockquote

Where xxx.cfm are different file names and XXX are different link words. 


How can I search for these in BBEdit? I know how to delete them once I can 
find them all. 

Thanks.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Search and Replace links with different file names

2014-02-27 Thread Oliver Taylor
On 27 Feb 2014, at 11:27 AM, outtacontext jeff.ga...@gmail.com wrote:

 I need to search for this string and delete all of them in 70 web pages. The 
 only problem is that the file names are different as are the link names (I've 
 bolded  and made red those the part of the search that will be different in 
 every file):
 
  blockquote
h3a href=/exhibitions/online/roby/xxx.cfmXXX /a/h3
  /blockquote

Assuming you want to delete the entire blockquote...

Go to Search  Multi-File Search...

Open BBEdit's find window and paste this into the Find field:

 blockquote
 [ ]*h3a href=/exhibitions/online/roby/(.+).cfm(.+) /a/h3
 /blockquote

Leave the Replace field blank.

Make sure that Matching: Grep is enabled.

Then select the files you want to search.

For a dry-run just click Find All - and when you're ready click Replace All.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Search and Replace links with different file names

2014-02-27 Thread Christopher Stone
On Feb 27, 2014, at 13:27, outtacontext jeff.ga...@gmail.com wrote:
 I need to search for this string and delete all of them in 70 web pages. The 
 only problem is that the file names are different as are the link names (I've 
 bolded  and made red those the part of the search that will be different in 
 every file):
__

Hey There,

And why is that a problem?  :)

Find:

(?xi) # Freespacing ON and case-sensitive OFF
^[[:blank:]]*blockquote[[:blank:]]*\r
^[[:blank:]]*h3a[[:blank:]]href=/exhibitions/online/roby/.+?\.cfm.+?/a/h3[[:blank:]]*\r
^[[:blank:]]*/blockquote[[:blank:]]*\r?

Replace:

With Nothing.

Using Multi-File Search.

Note: With freespacing on in the pattern all whitespace must be explicitly 
defined.  (The pattern works as is.)  I also have case-sensitive turned OFF.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Search and Replace links with different file names

2014-02-27 Thread outtacontext
Thanks all for your quick responses. 

Oliver, when I used yours and did a find, BBEdit didn't find anything. :-( 

Christopher, yours worked. But I would you explain your comment:

Note: With freespacing on in the pattern all whitespace must be explicitly 
 defined.  (The pattern works as is.)  I also have case-sensitive turned OFF.


And, can you briefly explain the syntax? Oliver's is easy to understand. 
But I don't get yours and I would like to so I know how to do this in the 
future.  

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Search and Replace links with different file names

2014-02-27 Thread Christopher Stone
Hey Jeff,

On Feb 27, 2014, at 15:34, outtacontext jeff.ga...@gmail.com wrote:
 Oliver, when I used yours and did a find, BBEdit didn't find anything. :-( 

At first blush it looks like Oliver didn't account for the possibility of 
variable whitespace.

 Christopher, yours worked. But I would you explain your comment:
 
 Note: With freespacing on in the pattern all whitespace must be explicitly 
 defined.  (The pattern works as is.)  I also have case-sensitive turned OFF.

http://www.regular-expressions.info/freespacing.html

In short - with free-spacing ON you can insert space, tab, return/linefeed 
without affecting the regular expression pattern.

This allows you to use whitespace to break up your pattern to make it more 
readable, and it free-spacing also allows for in-line comments in the pattern.

Ordinarily a string like this:

some-text


Will find some-textreturn/linefeed.

The end-of-line character depends on what editor you're working in, and if you 
don't know the difference between \n (Unix), \r (Classic Mac), and \r\n 
(Windows) you can get into to some frustrating situations.

I meant that case-insensitive is turned OFF by the pattern rather than in the 
BBEdit find dialog.

 And, can you briefly explain the syntax? Oliver's is easy to understand. But 
 I don't get yours and I would like to so I know how to do this in the future.

Briefly?  :)

You'll need to study up on regular expressions if you want some real 
understanding[1].

Pattern:

(?xi) # Freespacing ON and case-sensitive OFF
^[[:blank:]]*blockquote[[:blank:]]*\r
^[[:blank:]]*h3a[[:blank:]]href=/exhibitions/online/roby/.+?\.cfm.+?/a/h3[[:blank:]]*\r
^[[:blank:]]*/blockquote[[:blank:]]*\r?

Explanation:

(?xi)   == Pattern modifiers (p. 180 BBEdit Manual); x = free-spacing, i = 
case-insensitive.
== In the case above these are switched ON
== Note the in-line comment in the pattern: # Freespacing ON and 
case-sensitive OFF
^   == Beginning of line.
[[:blank:]] == Horizontal whitespace (space, non-breaking-space, tab).
*   == Zero or more instances of the character, group, or range that 
precedes it.
+   == One or more instances of the character, group, or range that 
precedes it.
?   == One or zero instances of the character, group, or range that 
precedes it.
.   == Any character.
\   == Escape character turning special regex characters like . into 
literal \. characters.
== Or turning literal characters into special characters like \t 
tab.
\r  == Return character (synonymous with \n in BBEdit but not 
elsewhere).

That's about all I have time for.

--
Best Regards,
Chris


[1]:
--
Some Information on Learning Regular Expressions
--

Learning basic regular expressions is relatively easy.  Becoming really good 
with them takes dedication, a lot of practice, and some tutelage.

The BBEdit Manual devotes a whole chapter to regular expressions: Searching 
with Grep (currently chapter 8).  It's a reference rather than a tutorial, but 
it does explain at least briefly many of the fundamentals.

My cheat-sheet for BBEdit/TextWrangler is up on Gist: 
https://gist.github.com/ccstone/5385334.  BBEdit/TextWrangler uses PCRE (Perl 
Compatible Regular Expressions), so it's a pretty decent if not complete 
reference.

Regex neophytes are better off starting with a book specifically written for 
beginners.

I have these books (in addition to a couple of tomes on Perl):

Sams Teach Yourself Regular Expressions in 10 Minutes by Ben Forta
Beginning Regular Expressions by Andrew Watt
Regular Expressions Cookbook  by Jan Goyvaerts and Steven Levithan
Mastering Regular Expressions by Jeffrey Friedl (Advanced)

There's a decent little utility available on the App-Store called 'Patterns' 
that live-updates as you create your pattern. ($2.99)

http://itunes.apple.com/us/app/patterns-the-regex-app/id429449079?mt=12

I've found it very handy to have live feedback when building a complex pattern 
and wish I'd had something like that when I started learning regex more than 20 
years ago.

Extracting a good working knowledge of regular expressions from the Internet is 
a serious chore.  There are many flavors of regex out there, such as Perl/PCRE, 
Java, Javascript, Ruby, Python, TCL...  They're all similar, but the 
differences can be very confusing and frustrating.

Nevertheless there are many useful online resources.  Here are a few:

http://www.agillo.net/regex-primer-part-1/
http://www.agillo.net/regex-primer-part-2/
http://www.codeproject.com/KB/dotnet/regextutorial.aspx
http://www.regular-expressions.info/tutorial.html

--

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

spooked

2014-02-27 Thread Mike Warren
New to BBEdit as of last month. 

I publish a website in the Dropbox Public folder. 

I develop these pages in a folder on my mac under Documents. When changes 
are ready, I copy them over to the Dropbox Public folder. 

The project I use in BBEdit for creating and editing pages works with the 
version of the website in the Documents folder. But, when I create new 
documents, BBEdit automatically, and contrary to my wishes, copies the new 
file to the Dropbox folder as well as the Documents folder. Editing 
existing pages, however, does not result in automatic updates to the 
Dropbox site. I have not yet played around with BBEdit's site/ftp features. 

Is this a feature? Is there a way to turn it off? Kinda spooks me out.  

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
supp...@barebones.com 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: spooked

2014-02-27 Thread Rich Siegel

On Thursday, February 27, 2014, Mike Warren mike.tartar...@gmail.com
wrote:


But, when I create new documents, BBEdit automatically, and contrary
to my wishes, copies the new file to the Dropbox folder as well as the
Documents folder.


...no.

:-)

It's possible that perhaps you have something set up which is 
mirroring files to your Dropbox automatically, but there is 
nothing anywhere in BBEdit that would do anything remotely like 
this. I would have insufficient basis to even guess at what 
might actually be happening.


(Note that BBEdit *does* have a feature which saves backup 
copies of documents; this is controlled in the Text Files 
preferences, affects *every* save of a document, not just newly 
created ones, and is off by default.)


I am, however, intrigued by this and curious to hear what you 
determine the cause to actually be.


R.
--
Rich Siegel Bare Bones Software, Inc.
sie...@barebones.com  http://www.barebones.com/

Someday I'll look back on all this and laugh... until they 
sedate me.


--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

supp...@barebones.com 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.