Hey Mike,

On 04/10/2018, at 14:47, Mike W <ymwie...@gmail.com 
<mailto:ymwie...@gmail.com>> wrote:
> Are you talking about the chrome add-on? We cant do this due to HIPAA (they 
> require access to all your files) 

Type Cmd-Shift-? in any application to access the Help menu's Search field.

Do this in BBEdit and then type “factory”.

This should be a first step whenever you're looking for a feature in Mac 

If you don't find it then take a minute and search the user manual.

Menu --> Help --> User Manual

A BBEdit Text Factory will probably be the easiest method for you to 
implementing a multi-find/replace action, but there are other methods available.

You'll have to learn a little bit but not a lot.

Search the user manual for “Text Factory”, and try searching BBEdit-Talk as 

On 04/10/2018, at 15:06, Mike W <ymwie...@gmail.com 
<mailto:ymwie...@gmail.com>> wrote:
> I've never used Scrip editor. the "↵" symbol i put in, I actually need it to 
> "move to next line" in BBEdit I just do "command + enter" what do i put in 
> the Script to move to next line? 
> I would much rather use Grep but I'm not sure I know how to create what 
> you're describing. when i select Find Replace i only see the option for 1 
> search and only a Grep check box. No option to Start at top or do multiple at 
> same time

That's Script Editor.app, and it's the AppleScript/JXA editor provided with the 
macOS.  (Use Spotlight to find it.)

I'd rather use AppleScript than a Text Factory any day, but then again I'm very 
familiar with it.

** Note that Fletcher's script below is not using RegEx (although it's possible 
to do so).


tell application "BBEdit"
    replace "~NM1*87*2~N3*" using "↵ BILLING ADDRESS: " searching in text 1 of 
front text document options {starting at top:true}
    replace "~DMG*D8*" using "↵ SUB DOB: " searching in text 1 of front text 
document options {starting at top:true}
    replace "~~NM1*82*1*" using "↵ PROVIDER NAME: " searching in text 1 of 
front text document options {starting at top:true}
end tell


On 04/10/2018, at 13:39, Mike W <ymwie...@gmail.com 
<mailto:ymwie...@gmail.com>> wrote:
> Is there a search pattern that would be able to do a Multiple Find and 
> Replace at once?
> I have a large file and dozens of items that need to be replaced.
> Here are some examples: 
> find: "~NM1*87*2~N3*" and replace with "↵ BILLING ADDRESS: "
> find: "~DMG*D8*" and replace with "↵ SUB DOB: "
> find: "~~NM1*82*1*" and replace with "↵ PROVIDER NAME:  "

Are these regular expressions or literal strings?

For a huge mess of find/replace actions I personally would turn to Perl, 
because it's easy to write, read, and maintain.

#!/usr/bin/env perl -sw

while (<>) {

        s!~~NM1\*82\*1\*!\n PROVIDER NAME:!g;

        s!~DMG\*D8\*!\n SUB DOB:!g;

        s!~NM1\*87\*2~N3\*!\n BILLING ADDRESS:!g;


This would be used in a Text Filter as opposed to a Text Factory.

Each of the lines beginning with s! is a find/replace action, and the basic 
structure is this:

s!<search_pattern>!<replace_pattern>!g; <-- Global switch - try more than 1 
replacement per line.

Not knowing if your strings are literal or not I've escaped the possible 
regular expression tokens.

BBEdit text-filters operate on the selection if there is one, otherwise they 
operate on the whole front document.

Text filters are installed here:

~/Library/Application Support/BBEdit/Text Filters/

Text filters are run from:

BBEdit Menu Bar > Text > Apply Text Filter > <your_filter>

And of course you can give them keyboard shortcuts in BBEdit's Menus & 
Shortcuts preferences.


Someone else mentioned the new Canonize command.  It lets you assign a bunch of 
literal text replacements in a file and then apply them to the front document.  
(See page 127 of the user manual.)

This might just be easier than a Text Factory (for literal replacements).

Now you probably have more choices than you wanted.

Hang in there and learn something new.  😎

Best Regards,

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.
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to