Can I _find_ "gremlins" instead of "zap"ping them?

58 views
Skip to first unread message

TJ Luoma

unread,
Feb 22, 2020, 5:26:18 PM2/22/20
to BBEdit MailingList
I often use "zap gremlins" (one of my favorite features of BBEdit) but
sometimes I'd rather _locate_ them instead of zapping them so I can
manually change them.

Is that possible? If so, how?

Greg Raven

unread,
Feb 23, 2020, 8:28:30 AM2/23/20
to BBEdit Talk
The easiest way I have found is to zap them, then search for the zap character.

GP

unread,
Feb 23, 2020, 8:58:19 AM2/23/20
to BBEdit Talk


On Saturday, February 22, 2020 at 2:26:18 PM UTC-8, TJ Luoma wrote:
The solution depends upon the BBEdit class of gremlins you're trying to find.

For the non-ASCII characters class, a "Find All" using the grep pattern:

[^\x00-\x7F]

will find all non-ASCII characters.

For the Null (ASCII 0) characters class, a "Find All" using the grep pattern:

[\x00]

will find all Null (ASCII 0) characters.

For the Control characters class, I'm not certain without more testing what traditional ASCII control characters BBEdit excludes from the Zap Gremlins Control characters class and what the file line endings dependancies might be.  With Unix line endings, I know the horizontal tab (\x09) and line feed (\x0A) are excluded from the Zap Gremlins Control characters class.  So, assuming exclusion of those two characters, presuming also excluding the special case Null (ASCII 0) character, and including the delete (\x7F) character, a "Find All" using the grep pattern:

[\x01-\x08\x0B-\x1F\x7F]

is a first try for finding BBEdit's Zap Gremlins Control characters class of characters in a file.

Message has been deleted

Darren Duncan

unread,
Feb 23, 2020, 8:58:20 AM2/23/20
to bbe...@googlegroups.com
The short and simple answer is use BBEdit's "compare" feature to compare a
document with a copy that has "zap gremlins" applied to it. One way is copying
to a new document, another is comparing with the pre-zap version saved to disk,
and so on. -- Darren Duncan

Kaveh Bazargan

unread,
Feb 23, 2020, 8:58:20 AM2/23/20
to bbe...@googlegroups.com
Search for 
[^ -~]
with "grep" switched on :-)

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/CADjGqHuycUTuGcyiVHoHnPGiX2RwFPGKLespqy%2BgyN5-14Reag%40mail.gmail.com.


--
Kaveh Bazargan PhD

Tom Robinson

unread,
Feb 23, 2020, 3:16:18 PM2/23/20
to bbe...@googlegroups.com
For anyone else wondering about that:

The square brackets are a character class.

^ negates the following characters
space is the first printable ASCII character (0x20)
- hyphen for a range
~ is the last printable ASCII character (0x7E)

So find anything not in the range 0x20 to 0x7E.

Cheers


> On 2020-02-24, at 02:35, Kaveh <ka...@rivervalleytechnologies.com> wrote:
>
> I replied by email and assumed it would appear here. You could try:
>
> [^ -~]
>
> with "grep" switched on. The magic of regex!

Kaveh Bazargan

unread,
Feb 23, 2020, 4:12:21 PM2/23/20
to bbe...@googlegroups.com
Thank you Tom. And it was not my idea in the first place. I stole it some time back from here:


and put a not (^) in front of it. But it is so short and elegant I always remember it. ;-)
Reply all
Reply to author
Forward
0 new messages