Best way to edit recently saved searches.

231 views
Skip to first unread message

dur...@vt.edu

unread,
Jul 1, 2015, 9:55:08 AM7/1/15
to bbe...@googlegroups.com
My drop-down of recently saved searches has grown unwieldy and needs editing. Some stuff needs to be deleted and other wants moving about. I read TFM and either didn't search for the right thing or the answer's not in there. I have BBEdit 9.6 on my old G5 running Leopard and 10.5 on my machine with Mavericks. No doubt the file of saved searches is different between the two, right?l Thanks for any advice.

dur...@vt.edu

unread,
Jul 2, 2015, 2:09:55 PM7/2/15
to bbe...@googlegroups.com
Umm. Not recently saved, just saved. When I RTFM I found a few references to recent searches but none to saved searches. Recent searches showed up in BBEdit prefs using a plist editor. I conflated the two. I want to edit the Saved Searches.

Christopher Stone

unread,
Jul 2, 2015, 2:42:58 PM7/2/15
to BBEdit-Talk
On Jul 02, 2015, at 13:09, dur...@vt.edu wrote:
> Umm. Not recently saved, just saved.
______________________________________________________________________

Hey There,

Try Menu-Bar BBEdit > Setup

Then go to the Patterns pane of the setup-window.

--
Best Regards,
Chris

Bull Durham

unread,
Jul 2, 2015, 3:21:59 PM7/2/15
to bbe...@googlegroups.com
Thanks, that does the trick for my version 10 BBEdit. I still need to do it with v9 though. There’s no Setup menu there.

Lawrence San

unread,
Jul 3, 2015, 8:32:13 PM7/3/15
to BBEdit-Talk
To edit saved searches in BBEdit 9, go to BBEdit menu (upper right of Mac's menu bar) > Preferences > Text Search (near the bottom of the list).  There you'll see a list called "Grep patterns" along with associated buttons for "Change" and "Remove..." that let you edit the items in the list. I'm not sure what happens with non-Grep searches, because I generally don't care about saving or editing those long-term.

I've been crafting complex scripts for years that utilize BBEdit saved Grep searches, in conjunction with various AppleScripts and OSA JavaScripts. If you're curious to see the list (which is a clue to what's possible with that combination)... I just slapped together a page with screenshots of my BBEdit saved searches list. It's at http://sanstudio.com/tech/BBEdit_Saved_Searches.html.

​It looks like a list of scripts, I guess, but it's actually my saved searches list, which is what triggers (or in some cases is utilized by/interacts with) all those scripts. (I have a separate long hierarchical list for all my BBEdit pure-AppleScripts.) I wonder if anyone else has ever created a complex structure like that based on saved regexp searches? In retrospect it may not have been such a good idea: they all work, but it was very time-consuming, and I'm guessing it's very fragile and would all come crashing down if I tried to upgrade from BBEdit 9 and Snow Leopard.

​Lawrence​

Bull Durham

unread,
Jul 4, 2015, 11:52:51 AM7/4/15
to bbe...@googlegroups.com
Thanks, I found that. But I cannot reorder the items in the list. The manual says they drag to new positions but mine don’t.

Lawrence San

unread,
Jul 4, 2015, 4:36:00 PM7/4/15
to BBEdit-Talk
Bull Durham said:
...I cannot reorder the items in the list. The manual says they drag to new positions but mine don’t.

Mine neither. According to my own tech/devel notes about BBEdit's Search features, Bare Bones introduced the position-drag feature in version 8.5, but it seems to have disappeared from version 9.

If you want total control over the list and what the items do, they're stored in a file called Grep Patterns.xml (on my system, anyway). It's in the system's user Library > Preferences > com.barebones.bbedit.PreferenceData > Grep Patterns.xml .  Mine is a very long file, with items corresponding to those in my search Prefs list. For example, the first two items in my Prefs list are:

     Markers Replacement Pattern

     Find one of ANYTHING

...and the beginning of my Grep Patterns.xml document is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>SavedGrepPatterns</key>
    <array>
        <dict>
            <key>ReplacePattern</key>
            <string>\1\1\1\1\u\2\L\3</string>
            <key>SearchPattern</key>
            <string>(?&lt;=º)[-–= ]*(\t*)(.)(.*?)(?=[-\s:–=]*(\*/)?(--&gt;)?\r)</string>
            <key>Title</key>
            <string>Markers Replacement Pattern</string>
            <key>UniqueID</key>
            <string>DACD6E58-848E-47F1-8032-82B84DC6B79B</string>
        </dict>
        <dict>
            <key>ReplacePattern</key>
            <string></string>
            <key>SearchPattern</key>
            <string>(?s).</string>
            <key>Title</key>
            <string>Find one of ANYTHING</string>
            <key>UniqueID</key>
            <string>0B2FDE15-AB57-4A4F-B322-BC67246B313E</string>
        </dict>

The following is copied directly from the tech/devel notes I wrote about this, years ago:

The Grep Patterns file is organized by blocks of four lines, hard to
keep track of. It works like this:

1. Title of search/replace strings
2. Search regexp
3. Replacement regexp
4. Blank line

This pattern repeats ad infinitum. Of course the lines don't actually
have numerals 1,2,3,4 in front of them, which is why it's hard to
keep track. Here's how to tell:

Divide the BBEdit line number by 4. If the remainder is:
    .25,     it's Line 1
      .5,     it's Line 2
    .75,     it's Line 3
    No remainder, it's Line 4

I wrote that years ago (probably using BBEdit 7), and the order it describes doesn't seem to correspond to what I'm seeing in the XML file now, so I guess the organization has changed somewhat. (The replacement pattern seems to come before the search pattern now.) But even if you're not trying to edit the search items themselves, you can see how you could just drag the blocks of code around to re-order them.

I obviously edited that file in BBEdit itself, but I don't remember whether it's necessary to quit and relaunch to see the changes. Also, I would strongly suggest that you dupe or back up the file in some way before messing with it. And as I said before, I don't know anything about non-regexp searches, because I never cared where they were stored or how to edit them; it's possible they're stored in the same file even though they're not "greps".

Good luck.


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



--
Lawrence San
Business Writing: Santhology.com
Cartoon Stories for Thoughtful People: Sanstudio.com


Patrick Woolsey

unread,
Jul 6, 2015, 10:00:47 AM7/6/15
to bbe...@googlegroups.com
On 7/3/15 at 8:31 PM, lawre...@gmail.com (Lawrence San) wrote:

>[...] I just slapped together a page with screenshots of my BBEdit saved
>searches list.

>[...] I wonder if anyone else has ever created a complex
>structure like that based on saved regexp searches?

Yes :-)


>In retrospect it may not have been such a good idea: they all work, but it was
>very time-consuming, and I'm guessing it's very fragile and would all come
>crashing down if I tried to upgrade from BBEdit 9 and Snow Leopard.

Those patterns should come through just fine (or on the
off-chance you _do_ see any problems, support is the place to
write :-).


Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com/>

dur...@vt.edu

unread,
Jul 9, 2015, 3:18:56 PM7/9/15
to bbe...@googlegroups.com
Just to close out this discussion:

You can not rearrange saved searches in v9.6.

You can rearrange saved searches in v10.5 via Setup.

If you are running both versions on different machines, you can move a copy of 'Grep Searches.xml' from the older version to the newer, with a temporary re-name of the file on the newer version. Edit them there, and move the file back to the old version. It's better than messing with the .xml file directly (but not as exciting, and with much more predictable results).

In 9.6 the file to edit is at 

/Users/USERNAME/Library/Preferences/com.barebones.BBEdit.PreferenceData/Grep Patterns.xml

while in BBEdit 10 and later, the pattern file resides within BBEdit's app support folder:

/Users/USERNAME/Library/Application Support/BBEdit/Setup/Grep Patterns.xml

Thanks to all who replied.

Wayne Durham


On Wednesday, July 1, 2015 at 9:55:08 AM UTC-4, dur...@vt.edu wrote:
Reply all
Reply to author
Forward
0 new messages