Re: Displaying TSV files

2023-03-17 Thread Bruce Van Allen
In addition to Rich’s suggestion, you could set tab width to a 
larger-than-normal size, to put more space between columns.

I have a little utility written in Applescript, saved in BBEdit’s Scripts 
folder, that adds 12 spacebar spaces to the tab width. Successive calls to the 
script keep widening the tabs until they hit a maximum (64 spaces), at which it 
reverts to standard 4 spaces per tab.

tell application “BBEdit"
  set tabW to tab width of text window 1
  if tabW > 64 then
set tabW to 4
  else
set tabW to tabW + 12
  end if
  set tab width of text window 1 to tabW
end tell

I assign a keyboard combo to the script (in BBEdit’s Menus and Shortcuts 
settings/preferences), so I can quickly space out some columns to more clearly 
view the data.

Changing BBEdit’s tab width doesn’t change the file, just the view in BBEdit.

Also check out the Edit -> Columns menu, which allows selecting and 
manipulating whole columns. Sometimes a column selection will reveal a problem.

Another approach, which you might prefer over visually inspecting your files, 
would be a script that checks every line to be sure there are correct number of 
columns (or tabs). The core of such a script could be a regular expression that 
assumes the correct number of columns; if you search on it BBEdit, you’ll get a 
results window with the number of records/lines found - if that’s not the same 
as the number of lines in the file, you’ll need to check the file. A more 
elaborate script could pull out the errant lines for you...


— Bruce

_bruce__van_allen__santa_cruz_ca_





> On Mar 17, 2023, at 3:35 PM, Laurel Cooper  wrote:
> 
> I work with large, tsv-formatted text files The files are 17 column text 
> files with the columns separated by tabs.  I need to be able to see that none 
> of the tabs are missing. 
> I can see the tab stops by turning on "Show invisibles", but in some lines 
> the tabs are basically on top of each other, and in other places, the text is 
> on top of them.  
> Is there a better way to display these files? 
> I took a screen shot as an example:
> Thanks!
> 
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/a0702843-bbee-486f-a828-0bb6faff8d51n%40googlegroups.com.
> 

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/23CDD6FA-789B-4156-8F3A-91770A977627%40cruzio.com.


Re: Displaying TSV files

2023-03-17 Thread Laurel Cooper

Thanks!  I am on version 14.6.4
I tried changing it to Courier font and that is actually much easier to 
read.

Laurel

On 3/17/23 3:52 PM, Rich Siegel wrote:

[This email originated from outside of OSU. Use caution with links and 
attachments.]

On 17 Mar 2023, at 18:35, Laurel Cooper wrote:


I work with large, tsv-formatted text files The files are 17 column text
files with the columns separated by tabs.  I need to be able to see that
none of the tabs are missing.
I can see the tab stops by turning on "Show invisibles", but in some lines
the tabs are basically on top of each other, and in other places, the text
is on top of them.
Is there a better way to display these files?

I recommend using BBEdit 14.6.x and a monospaced font; if you're using a 
pre-14.6 version, try updating and see how that works for you.

R.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, 
please email"supp...@barebones.com"  rather than posting here. Follow @bbedit on 
Twitter:
---
You received this message because you are subscribed to a topic in the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this topic, 
visithttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fbbedit%2F0YzW2hob050%2Funsubscribe=05%7C01%7Ccooperl%40oregonstate.edu%7Ca5b0447f88644cdb806108db273a3de8%7Cce6d05e13c5e4d6287a84c4a2713c113%7C0%7C0%7C638146903320573795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=6hB8PI1KKJGoht1uq4XQT%2BNPlAy4J%2F9y1GxW51bnTIw%3D=0.
To unsubscribe from this group and all its topics, send an email 
tobbedit+unsubscr...@googlegroups.com.
To view this discussion on the web 
visithttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fbbedit%2F297AB881-F0D7-4591-B401-8619F17B0C56%2540barebones.com=05%7C01%7Ccooperl%40oregonstate.edu%7Ca5b0447f88644cdb806108db273a3de8%7Cce6d05e13c5e4d6287a84c4a2713c113%7C0%7C0%7C638146903320573795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=my6v6I7SLwXaEhUQJHZN4k%2B40ZmerXf82vqB%2BPFPjkQ%3D=0.


--
Laurel Cooper
Dept. of Botany and Plant Pathology
2503 Cordley Hall
Oregon State University
Corvallis, OR 97331

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "supp...@barebones.com" rather than posting here. 
Follow @bbedit on Twitter: 
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b6787439-8b61-8540-9eed-54fca1375756%40oregonstate.edu.


Re: Displaying TSV files

2023-03-17 Thread Rich Siegel
On 17 Mar 2023, at 18:35, Laurel Cooper wrote:

> I work with large, tsv-formatted text files The files are 17 column text
> files with the columns separated by tabs.  I need to be able to see that
> none of the tabs are missing.
> I can see the tab stops by turning on "Show invisibles", but in some lines
> the tabs are basically on top of each other, and in other places, the text
> is on top of them.
> Is there a better way to display these files?

I recommend using BBEdit 14.6.x and a monospaced font; if you're using a 
pre-14.6 version, try updating and see how that works for you.

R.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/297AB881-F0D7-4591-B401-8619F17B0C56%40barebones.com.


Re: Need help simplifying apple script with grep

2023-03-17 Thread Kaveh Bazargan
Thanks Bruce. I am familiar with grep and use it a lot. Also used a lot
of AppleScript in the past but no regex in that.

It's just that the extra escape and all the verbosity in AppleScript makes
it painful to decode!

On Fri, 17 Mar 2023 at 14:30, Bruce Van Allen  wrote:

> Yes, double escapes are needed. As handy as Applescript is, quoting is a
> major pain point.
>
> ‘*’ has special meaning within regular expressions, so it must be escaped
> when trying to match a literal ‘*’. So that's the first ‘\’. Then
> Applescript needs that ‘\’ escaped, so we get ‘\\*’.
>
> The BBEdit User Manual (PDF download via the Help menu) has a good
> discussion of this.
>
> — Bruce
>
> _bruce__van_allen__santa_cruz_ca_
>
>
>
>
>
> > On Mar 17, 2023, at 7:23 AM, Kaveh Bazargan 
> wrote:
> >
> > Quick question: For AppleScript you need to double escape, right? so:
> > •
> > in AppleScript: \\*
> > • becomes \* in BBEdit
> > • to find "*"
> >
> >
> > On Fri, 17 Mar 2023 at 13:36, Bruce Van Allen  wrote:
> > Oops - I mis-typed one bit: the inner part of the find pattern should be
> “[^*]” - asterisk instead of plus sign.
> >
> > tell application “BBEdit"
> >   tell front text window
> > replace "/\\*([^*]*?)\\*/" using "" options ¬
> > {search mode:grep, case sensitive:false, starting at top:true}
> >   end tell
> > end tell
> >
> >
> > — Bruce
> >
> > _bruce__van_allen__santa_cruz_ca_
> >
> >
> >
> >
> >
> > > On Mar 17, 2023, at 6:08 AM, Bruce Van Allen  wrote:
> > >
> > > Here’s a slightly amended version of your script:
> > >
> > > tell application “BBEdit”
> > >  tell front text window
> > >replace "/\\*([^+]*?)\\*/" using "" options ¬
> > > {search mode:grep, case sensitive:false, starting at top:true}
> > >  end tell
> > > end tell
> > >
> > > The differences are:
> > >
> > > - no parentheses () surrounding the whole find pattern because that
> becomes the first capture, which you use in the replacement pattern as ‘\1’.
> > >
> > > - added parens around the inner part of the find pattern, in order to
> capture what’s between the JS comment markers.
> > >
> > > -  if you needed to keep that outer parens capture for some other
> reason, then change the replacement pattern to “” (assuming that
> part stays the second parens-capture).
> > >
> > > - I omitted the replace “%@“ line to keep this part of the script
> clear.
> > >
> > > Using the script as I wrote it above
> > >
> > > /* some commented stuff */ /*some more*/
> > >
> > > And /* some more*/
> > >
> > > is transformed in one step into
> > >
> > >  
> > >
> > > And 
> > >
> > >
> > > HTH
> > >
> > >— Bruce
> > >
> > > _bruce__van_allen__santa_cruz_ca_
> > >
> > >
> > >
> > >
> > >
> > >> On Mar 17, 2023, at 3:04 AM, Mathias  wrote:
> > >>
> > >> OK, so I'm working on an apple script to replace Localizable (apple)
> comments on the /* ... */ format to 
> > >>
> > >> I got it working, but I'm using two commands because I couldn't
> figure the grep out... can this be simplified with only one "replace" ?
> > >>
> > >> pointers appreciated, script here:
> > >>
> > >> tell application "BBEdit"
> > >> tell front text window
> > >> replace "(/\\*[^\\*]*\\*/)" using "" options ¬
> > >> {search mode:grep, case sensitive:false, starting at top:true}
> > >> replace "(/\\*|\\*/)" using "" options {search mode:grep, case
> sensitive:false, starting at top:true}
> > >> replace "%@" using "%1$s" options {case sensitive:false, starting at
> top:true}
> > >>
> > >> end tell
> > >> end tell
> > >>
> > >> --
> > >> This is the BBEdit Talk public discussion group. If you have a
> feature request or need technical support, please email "
> supp...@barebones.com" rather than posting here. Follow @bbedit on
> Twitter: 
> > >> ---
> > >> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/65afd9cc-0a86-4821-b302-20b2948c3cdcn%40googlegroups.com
> .
> > >
> > > --
> > > This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "supp...@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+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/B37085B8-A95C-4105-B396-5E089AADFEFB%40cruzio.com
> .
> >
> > --
> > This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "supp...@barebones.com"
> rather than posting here. Follow 

Re: Need help simplifying apple script with grep

2023-03-17 Thread Bruce Van Allen
Yes, double escapes are needed. As handy as Applescript is, quoting is a major 
pain point.

‘*’ has special meaning within regular expressions, so it must be escaped when 
trying to match a literal ‘*’. So that's the first ‘\’. Then Applescript needs 
that ‘\’ escaped, so we get ‘\\*’.
 
The BBEdit User Manual (PDF download via the Help menu) has a good discussion 
of this.

— Bruce

_bruce__van_allen__santa_cruz_ca_





> On Mar 17, 2023, at 7:23 AM, Kaveh Bazargan  wrote:
> 
> Quick question: For AppleScript you need to double escape, right? so:
> • 
> in AppleScript: \\*
> • becomes \* in BBEdit
> • to find "*"
> 
> 
> On Fri, 17 Mar 2023 at 13:36, Bruce Van Allen  wrote:
> Oops - I mis-typed one bit: the inner part of the find pattern should be 
> “[^*]” - asterisk instead of plus sign.
> 
> tell application “BBEdit"
>   tell front text window
> replace "/\\*([^*]*?)\\*/" using "" options ¬
> {search mode:grep, case sensitive:false, starting at top:true}
>   end tell
> end tell
> 
> 
> — Bruce
> 
> _bruce__van_allen__santa_cruz_ca_
> 
> 
> 
> 
> 
> > On Mar 17, 2023, at 6:08 AM, Bruce Van Allen  wrote:
> > 
> > Here’s a slightly amended version of your script:
> > 
> > tell application “BBEdit”
> >  tell front text window
> >replace "/\\*([^+]*?)\\*/" using "" options ¬
> > {search mode:grep, case sensitive:false, starting at top:true}
> >  end tell
> > end tell
> > 
> > The differences are:
> > 
> > - no parentheses () surrounding the whole find pattern because that becomes 
> > the first capture, which you use in the replacement pattern as ‘\1’.
> > 
> > - added parens around the inner part of the find pattern, in order to 
> > capture what’s between the JS comment markers.
> > 
> > -  if you needed to keep that outer parens capture for some other reason, 
> > then change the replacement pattern to “” (assuming that part stays 
> > the second parens-capture).
> > 
> > - I omitted the replace “%@“ line to keep this part of the script clear.
> > 
> > Using the script as I wrote it above
> > 
> > /* some commented stuff */ /*some more*/
> > 
> > And /* some more*/
> > 
> > is transformed in one step into 
> > 
> >  
> > 
> > And 
> > 
> > 
> > HTH
> > 
> >— Bruce
> > 
> > _bruce__van_allen__santa_cruz_ca_
> > 
> > 
> > 
> > 
> > 
> >> On Mar 17, 2023, at 3:04 AM, Mathias  wrote:
> >> 
> >> OK, so I'm working on an apple script to replace Localizable (apple) 
> >> comments on the /* ... */ format to 
> >> 
> >> I got it working, but I'm using two commands because I couldn't figure the 
> >> grep out... can this be simplified with only one "replace" ? 
> >> 
> >> pointers appreciated, script here:
> >> 
> >> tell application "BBEdit"
> >> tell front text window
> >> replace "(/\\*[^\\*]*\\*/)" using "" options ¬
> >> {search mode:grep, case sensitive:false, starting at top:true} 
> >> replace "(/\\*|\\*/)" using "" options {search mode:grep, case 
> >> sensitive:false, starting at top:true} 
> >> replace "%@" using "%1$s" options {case sensitive:false, starting at 
> >> top:true} 
> >> 
> >> end tell
> >> end tell
> >> 
> >> -- 
> >> This is the BBEdit Talk public discussion group. If you have a feature 
> >> request or need technical support, please email "supp...@barebones.com" 
> >> rather than posting here. Follow @bbedit on Twitter: 
> >> 
> >> --- 
> >> 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 view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/bbedit/65afd9cc-0a86-4821-b302-20b2948c3cdcn%40googlegroups.com.
> > 
> > -- 
> > This is the BBEdit Talk public discussion group. If you have a feature 
> > request or need technical support, please email "supp...@barebones.com" 
> > rather than posting here. Follow @bbedit on Twitter: 
> > 
> > --- 
> > 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 view this discussion on the web visit 
> > https://groups.google.com/d/msgid/bbedit/B37085B8-A95C-4105-B396-5E089AADFEFB%40cruzio.com.
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> 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 view this discussion on the web visit 
> 

Re: Need help simplifying apple script with grep

2023-03-17 Thread Kaveh Bazargan
Quick question: For AppleScript you need to double escape, right? so:

   - in AppleScript: \\*
   - becomes \* in BBEdit
   - to find "*"


On Fri, 17 Mar 2023 at 13:36, Bruce Van Allen  wrote:

> Oops - I mis-typed one bit: the inner part of the find pattern should be
> “[^*]” - asterisk instead of plus sign.
>
> tell application “BBEdit"
>   tell front text window
> replace "/\\*([^*]*?)\\*/" using "" options ¬
> {search mode:grep, case sensitive:false, starting at top:true}
>   end tell
> end tell
>
>
> — Bruce
>
> _bruce__van_allen__santa_cruz_ca_
>
>
>
>
>
> > On Mar 17, 2023, at 6:08 AM, Bruce Van Allen  wrote:
> >
> > Here’s a slightly amended version of your script:
> >
> > tell application “BBEdit”
> >  tell front text window
> >replace "/\\*([^+]*?)\\*/" using "" options ¬
> > {search mode:grep, case sensitive:false, starting at top:true}
> >  end tell
> > end tell
> >
> > The differences are:
> >
> > - no parentheses () surrounding the whole find pattern because that
> becomes the first capture, which you use in the replacement pattern as ‘\1’.
> >
> > - added parens around the inner part of the find pattern, in order to
> capture what’s between the JS comment markers.
> >
> > -  if you needed to keep that outer parens capture for some other
> reason, then change the replacement pattern to “” (assuming that
> part stays the second parens-capture).
> >
> > - I omitted the replace “%@“ line to keep this part of the script clear.
> >
> > Using the script as I wrote it above
> >
> > /* some commented stuff */ /*some more*/
> >
> > And /* some more*/
> >
> > is transformed in one step into
> >
> >  
> >
> > And 
> >
> >
> > HTH
> >
> >— Bruce
> >
> > _bruce__van_allen__santa_cruz_ca_
> >
> >
> >
> >
> >
> >> On Mar 17, 2023, at 3:04 AM, Mathias  wrote:
> >>
> >> OK, so I'm working on an apple script to replace Localizable (apple)
> comments on the /* ... */ format to 
> >>
> >> I got it working, but I'm using two commands because I couldn't figure
> the grep out... can this be simplified with only one "replace" ?
> >>
> >> pointers appreciated, script here:
> >>
> >> tell application "BBEdit"
> >> tell front text window
> >> replace "(/\\*[^\\*]*\\*/)" using "" options ¬
> >> {search mode:grep, case sensitive:false, starting at top:true}
> >> replace "(/\\*|\\*/)" using "" options {search mode:grep, case
> sensitive:false, starting at top:true}
> >> replace "%@" using "%1$s" options {case sensitive:false, starting at
> top:true}
> >>
> >> end tell
> >> end tell
> >>
> >> --
> >> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "supp...@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+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/65afd9cc-0a86-4821-b302-20b2948c3cdcn%40googlegroups.com
> .
> >
> > --
> > This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "supp...@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+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/B37085B8-A95C-4105-B396-5E089AADFEFB%40cruzio.com
> .
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "supp...@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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/B4B02A99-8F77-4877-93AD-328302B74BBB%40cruzio.com
> .
>


-- 
Kaveh Bazargan PhD
Director
River Valley Technologies  ● Twitter
 ● LinkedIn
 ● ORCID
 ● @kaveh1000@mastodon.social

*Accelerating the Communication of Research*

*


Re: Need help simplifying apple script with grep

2023-03-17 Thread Bruce Van Allen
Oops - I mis-typed one bit: the inner part of the find pattern should be “[^*]” 
- asterisk instead of plus sign.

tell application “BBEdit"
  tell front text window
replace "/\\*([^*]*?)\\*/" using "" options ¬
{search mode:grep, case sensitive:false, starting at top:true}
  end tell
end tell


— Bruce

_bruce__van_allen__santa_cruz_ca_





> On Mar 17, 2023, at 6:08 AM, Bruce Van Allen  wrote:
> 
> Here’s a slightly amended version of your script:
> 
> tell application “BBEdit”
>  tell front text window
>replace "/\\*([^+]*?)\\*/" using "" options ¬
> {search mode:grep, case sensitive:false, starting at top:true}
>  end tell
> end tell
> 
> The differences are:
> 
> - no parentheses () surrounding the whole find pattern because that becomes 
> the first capture, which you use in the replacement pattern as ‘\1’.
> 
> - added parens around the inner part of the find pattern, in order to capture 
> what’s between the JS comment markers.
> 
> -  if you needed to keep that outer parens capture for some other reason, 
> then change the replacement pattern to “” (assuming that part stays 
> the second parens-capture).
> 
> - I omitted the replace “%@“ line to keep this part of the script clear.
> 
> Using the script as I wrote it above
> 
> /* some commented stuff */ /*some more*/
> 
> And /* some more*/
> 
> is transformed in one step into 
> 
>  
> 
> And 
> 
> 
> HTH
> 
>— Bruce
> 
> _bruce__van_allen__santa_cruz_ca_
> 
> 
> 
> 
> 
>> On Mar 17, 2023, at 3:04 AM, Mathias  wrote:
>> 
>> OK, so I'm working on an apple script to replace Localizable (apple) 
>> comments on the /* ... */ format to 
>> 
>> I got it working, but I'm using two commands because I couldn't figure the 
>> grep out... can this be simplified with only one "replace" ? 
>> 
>> pointers appreciated, script here:
>> 
>> tell application "BBEdit"
>> tell front text window
>> replace "(/\\*[^\\*]*\\*/)" using "" options ¬
>> {search mode:grep, case sensitive:false, starting at top:true} 
>> replace "(/\\*|\\*/)" using "" options {search mode:grep, case 
>> sensitive:false, starting at top:true} 
>> replace "%@" using "%1$s" options {case sensitive:false, starting at 
>> top:true} 
>> 
>> end tell
>> end tell
>> 
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "supp...@barebones.com" 
>> rather than posting here. Follow @bbedit on Twitter: 
>> 
>> --- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/65afd9cc-0a86-4821-b302-20b2948c3cdcn%40googlegroups.com.
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/B37085B8-A95C-4105-B396-5E089AADFEFB%40cruzio.com.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B4B02A99-8F77-4877-93AD-328302B74BBB%40cruzio.com.


Re: Need help simplifying apple script with grep

2023-03-17 Thread Bruce Van Allen
Here’s a slightly amended version of your script:

tell application “BBEdit”
  tell front text window
replace "/\\*([^+]*?)\\*/" using "" options ¬
{search mode:grep, case sensitive:false, starting at top:true}
  end tell
end tell

The differences are:

- no parentheses () surrounding the whole find pattern because that becomes the 
first capture, which you use in the replacement pattern as ‘\1’.

- added parens around the inner part of the find pattern, in order to capture 
what’s between the JS comment markers.

-  if you needed to keep that outer parens capture for some other reason, then 
change the replacement pattern to “” (assuming that part stays the 
second parens-capture).

- I omitted the replace “%@“ line to keep this part of the script clear.

Using the script as I wrote it above

/* some commented stuff */ /*some more*/

And /* some more*/

is transformed in one step into 

 

And 


HTH

— Bruce

_bruce__van_allen__santa_cruz_ca_





> On Mar 17, 2023, at 3:04 AM, Mathias  wrote:
> 
> OK, so I'm working on an apple script to replace Localizable (apple) comments 
> on the /* ... */ format to 
> 
> I got it working, but I'm using two commands because I couldn't figure the 
> grep out... can this be simplified with only one "replace" ? 
> 
> pointers appreciated, script here:
> 
> tell application "BBEdit"
> tell front text window
> replace "(/\\*[^\\*]*\\*/)" using "" options ¬
> {search mode:grep, case sensitive:false, starting at top:true} 
> replace "(/\\*|\\*/)" using "" options {search mode:grep, case 
> sensitive:false, starting at top:true} 
> replace "%@" using "%1$s" options {case sensitive:false, starting at 
> top:true} 
> 
> end tell
> end tell
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "supp...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: 
> 
> --- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/65afd9cc-0a86-4821-b302-20b2948c3cdcn%40googlegroups.com.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B37085B8-A95C-4105-B396-5E089AADFEFB%40cruzio.com.


Need help simplifying apple script with grep

2023-03-17 Thread Mathias
OK, so I'm working on an apple script to replace Localizable (apple) 
comments on the /* ... */ format to 

I got it working, but I'm using two commands because I couldn't figure the 
grep out... can this be simplified with only one "replace" ? 

pointers appreciated, script here:

*tell* *application* "BBEdit"

*tell* *front* *text window*

*replace* "(/\\*[^\\*]*\\*/)" using "" options ¬

{search mode:*grep*, case sensitive:*false*, starting at top:*true*} 

*replace* "(/\\*|\\*/)" using "" options {search mode:*grep*, case sensitive
:*false*, starting at top:*true*} 

*replace* "%@" using "%1$s" options {case sensitive:*false*, starting at top
:*true*} 

*end* *tell*

*end* *tell*

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/65afd9cc-0a86-4821-b302-20b2948c3cdcn%40googlegroups.com.