Re: RegExp and search / replace question - removing "" when around a single word without whitespace

2024-04-19 Thread Rainer Krug
Thanks Kerry and Jean - they look great. I will try both in real-world 
cases soon and come back if there are major problems I can't solve (likely 
any which involve modifying the regex...).

The regex will be used for text files with max about 100 lines - so a 
visual check afterwards is possible and in any case high;y advised.

Thanks a gain

Rainer


On Thursday, April 18, 2024 at 5:06:24 PM UTC+2 jj wrote:

> Oops, previous regex will flag :
>
> "tomato-sauce" or "mayonnaise-sauce"
>
> This one is a bit more strict:
> (?<=\s)"[\s\N{U+00A0}]*([^\s\N{U+00A0}"-]+?)[\s\N{U+00A0}]*"
>
> But it will still flag (see the space after tomato-sauce) :
> "tomato-sauce " or "mayonnaise-sauce"
>
> There might be more edge cases, so be cautious.
>
> Jean
> On Thursday, April 18, 2024 at 4:46:17 PM UTC+2 jj wrote:
>
>> Building on Kerri's solution to include non-breaking spaces, tabs and 
>> linefeeds, etc.
>>
>> find:
>> "[\s\N{U+00A0}]*([^\s\N{U+00A0}"-]+?)[\s\N{U+00A0}]*"
>>
>> replace:
>> \1
>>
>> [image: Screenshot 2024-04-18 at 16.42.39.png]
>>
>> HTH
>>
>> Jean Jourdain
>> On Thursday, April 18, 2024 at 3:19:21 PM UTC+2 Kerri Hicks wrote:
>>
>>> Maybe this will help?
>>>
>>> --Kerri
>>>
>>> [image: Screenshot 2024-04-18 at 9.16.46 AM.png]
>>>
>>> On Thu, Apr 18, 2024 at 8:37 AM Rainer Krug  wrote:
>>>
 Sure.
 Should be removed: (single words without whitespace or "-")

 "singleword" -> singleworls
 "Hello" -> Hello
 " Hello" -> Hello [whitespace after removal of " do not matter]
 " Hello " -> Hello
 "Hello " -> Hello

 Should NOT be removed: (strings with whitespace or "-" except ), i.e. 
 remain unchanged

 "Hello World" 
 "Hello big world"
 "tomato-sauce"
 " Hello World "

 Hope this helps,

 Rainer


 On Thursday, April 18, 2024 at 11:40:14 AM UTC+2 Kaveh Bazargan wrote:

> can you be more specific? What is the determining factor?
>
>- Exactly "this" > this
>- Only single words
>
> pls give some examples of before and after so we can see logic. 
> thanks. 
>
> On Thu, 18 Apr 2024 at 08:04, Rainer Krug  wrote:
>
>> Hi
>>
>> I had a regex but can't find it anymore (I found the "Manage Pattern" 
>> only now - it always reminds me of Google...).
>>
>> Could somebody give me a regex which removes the `"` around "this" 
>> word, but not "this word"?
>>
>> Thanks
>>
>> Rainer
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a 
>> feature request or believe that the application isn't working correctly, 
>> please email "sup...@barebones.com" rather than posting here. Follow 
>> @bbedit on Mastodon: 
>> --- 
>> 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/871a5d1f-aa12-49c5-a058-cec16619ea8cn%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Kaveh Bazargan PhD
> Director
> River Valley Technologies  ● Twitter 
>  ● LinkedIn 
>  ● ORCID 
>  ● @kave...@mastodon.social 
> 
> *Accelerating the Communication of Research*
>
> * 
> 
>   [image: 
> https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/]
>  
> *
>
 -- 
 This is the BBEdit Talk public discussion group. If you have a feature 
 request or believe that the application isn't working correctly, please 
 email "sup...@barebones.com" rather than posting here. Follow @bbedit 
 on Mastodon: 
 --- 
 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/95a71b97-e6a4-4295-8fe5-f90c29bec001n%40googlegroups.com
  
 

Re: RegExp and search / replace question - removing "" when around a single word without whitespace

2024-04-18 Thread jj
Oops, previous regex will flag :

"tomato-sauce" or "mayonnaise-sauce"

This one is a bit more strict:
(?<=\s)"[\s\N{U+00A0}]*([^\s\N{U+00A0}"-]+?)[\s\N{U+00A0}]*"

But it will still flag (see the space after tomato-sauce) :
"tomato-sauce " or "mayonnaise-sauce"

There might be more edge cases, so be cautious.

Jean
On Thursday, April 18, 2024 at 4:46:17 PM UTC+2 jj wrote:

> Building on Kerri's solution to include non-breaking spaces, tabs and 
> linefeeds, etc.
>
> find:
> "[\s\N{U+00A0}]*([^\s\N{U+00A0}"-]+?)[\s\N{U+00A0}]*"
>
> replace:
> \1
>
> [image: Screenshot 2024-04-18 at 16.42.39.png]
>
> HTH
>
> Jean Jourdain
> On Thursday, April 18, 2024 at 3:19:21 PM UTC+2 Kerri Hicks wrote:
>
>> Maybe this will help?
>>
>> --Kerri
>>
>> [image: Screenshot 2024-04-18 at 9.16.46 AM.png]
>>
>> On Thu, Apr 18, 2024 at 8:37 AM Rainer Krug  wrote:
>>
>>> Sure.
>>> Should be removed: (single words without whitespace or "-")
>>>
>>> "singleword" -> singleworls
>>> "Hello" -> Hello
>>> " Hello" -> Hello [whitespace after removal of " do not matter]
>>> " Hello " -> Hello
>>> "Hello " -> Hello
>>>
>>> Should NOT be removed: (strings with whitespace or "-" except ), i.e. 
>>> remain unchanged
>>>
>>> "Hello World" 
>>> "Hello big world"
>>> "tomato-sauce"
>>> " Hello World "
>>>
>>> Hope this helps,
>>>
>>> Rainer
>>>
>>>
>>> On Thursday, April 18, 2024 at 11:40:14 AM UTC+2 Kaveh Bazargan wrote:
>>>
 can you be more specific? What is the determining factor?

- Exactly "this" > this
- Only single words

 pls give some examples of before and after so we can see logic. thanks. 

 On Thu, 18 Apr 2024 at 08:04, Rainer Krug  wrote:

> Hi
>
> I had a regex but can't find it anymore (I found the "Manage Pattern" 
> only now - it always reminds me of Google...).
>
> Could somebody give me a regex which removes the `"` around "this" 
> word, but not "this word"?
>
> Thanks
>
> Rainer
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or believe that the application isn't working correctly, please 
> email "sup...@barebones.com" rather than posting here. Follow @bbedit 
> on Mastodon: 
> --- 
> 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/871a5d1f-aa12-49c5-a058-cec16619ea8cn%40googlegroups.com
>  
> 
> .
>


 -- 
 Kaveh Bazargan PhD
 Director
 River Valley Technologies  ● Twitter 
  ● LinkedIn 
  ● ORCID 
  ● @kave...@mastodon.social 
 
 *Accelerating the Communication of Research*

 * 
 
   [image: 
 https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/]
  
 *

>>> -- 
>>> This is the BBEdit Talk public discussion group. If you have a feature 
>>> request or believe that the application isn't working correctly, please 
>>> email "sup...@barebones.com" rather than posting here. Follow @bbedit 
>>> on Mastodon: 
>>> --- 
>>> 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/95a71b97-e6a4-4295-8fe5-f90c29bec001n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"supp...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: 

--- 
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 

Re: RegExp and search / replace question - removing "" when around a single word without whitespace

2024-04-18 Thread Rainer Krug
Sure.
Should be removed: (single words without whitespace or "-")

"singleword" -> singleworls
"Hello" -> Hello
" Hello" -> Hello [whitespace after removal of " do not matter]
" Hello " -> Hello
"Hello " -> Hello

Should NOT be removed: (strings with whitespace or "-" except ), i.e. 
remain unchanged

"Hello World" 
"Hello big world"
"tomato-sauce"
" Hello World "

Hope this helps,

Rainer


On Thursday, April 18, 2024 at 11:40:14 AM UTC+2 Kaveh Bazargan wrote:

> can you be more specific? What is the determining factor?
>
>- Exactly "this" > this
>- Only single words
>
> pls give some examples of before and after so we can see logic. thanks. 
>
> On Thu, 18 Apr 2024 at 08:04, Rainer Krug  wrote:
>
>> Hi
>>
>> I had a regex but can't find it anymore (I found the "Manage Pattern" 
>> only now - it always reminds me of Google...).
>>
>> Could somebody give me a regex which removes the `"` around "this" word, 
>> but not "this word"?
>>
>> Thanks
>>
>> Rainer
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or believe that the application isn't working correctly, please 
>> email "sup...@barebones.com" rather than posting here. Follow @bbedit on 
>> Mastodon: 
>> --- 
>> 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/871a5d1f-aa12-49c5-a058-cec16619ea8cn%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Kaveh Bazargan PhD
> Director
> River Valley Technologies  ● Twitter 
>  ● LinkedIn 
>  ● ORCID 
>  ● @kave...@mastodon.social 
> 
> *Accelerating the Communication of Research*
>
> * 
> 
>   [image: 
> https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/]
>  
> *
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"supp...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: 

--- 
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/95a71b97-e6a4-4295-8fe5-f90c29bec001n%40googlegroups.com.


Re: RegExp and search / replace question - removing "" when around a single word without whitespace

2024-04-18 Thread Kaveh Bazargan
can you be more specific? What is the determining factor?

   - Exactly "this" > this
   - Only single words

pls give some examples of before and after so we can see logic. thanks.

On Thu, 18 Apr 2024 at 08:04, Rainer Krug  wrote:

> Hi
>
> I had a regex but can't find it anymore (I found the "Manage Pattern" only
> now - it always reminds me of Google...).
>
> Could somebody give me a regex which removes the `"` around "this" word,
> but not "this word"?
>
> Thanks
>
> Rainer
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or believe that the application isn't working correctly, please
> email "supp...@barebones.com" rather than posting here. Follow @bbedit on
> Mastodon: 
> ---
> 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/871a5d1f-aa12-49c5-a058-cec16619ea8cn%40googlegroups.com
> 
> .
>


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

*Accelerating the Communication of Research*

*

 [image:
https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/]
*

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"supp...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: 

--- 
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/CAJ2R9phM5chRrgmpbUjmSnNC6f_Yb-aPmSEtySQatVWc78aZ%2Bw%40mail.gmail.com.


RegExp and search / replace question - removing "" when around a single word without whitespace

2024-04-18 Thread Rainer Krug
Hi

I had a regex but can't find it anymore (I found the "Manage Pattern" only 
now - it always reminds me of Google...).

Could somebody give me a regex which removes the `"` around "this" word, 
but not "this word"?

Thanks

Rainer

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"supp...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: 

--- 
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/871a5d1f-aa12-49c5-a058-cec16619ea8cn%40googlegroups.com.


Re: Search & Replace

2021-11-15 Thread R B Cohen
GEDitCom finally replied that there is option to turn the code off. Had no 
idea! So that deletes needing to replace the  1 _PLACE and the unique id 
1 _GCID. I'm left with the 1 AFN.  Will try your suggestion.

On Monday, November 15, 2021 at 8:49:06 PM UTC-5 listmei...@gmail.com wrote:

> On Nov 15, 2021, at 15:18, R B COHEN  wrote:
>
> 1 _GCID 94D0C28F-7346-4AC7-96D1-147294BADAF1
>
> --
>
> Hey R B,
>
> Is this the start of the line?
>
> Are these always _GCID numbers?
>
> Is the hyphenated alphanumeric string always 36 characters?
>
> Something like this:
>
> Find:
>
> (?-i)^.*[0-9A-Z]{8}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{12}.*\n?
>
> Replace:
>
> Nothing
>
> I then need to Find & Replace:
>
>
> FIND:
>
>
> 1 AFN  123.123.123  
>
> REPLACE: 
>
> 1 FACT 123.123.123  \n
> 2 TYPE Reference
>
>
> Something like this:
>
> Find:
>
> (\d+)\h+AFN\h+\b(\d+\.\d+\.\d+)\b
>
> Replace:
>
> \1 FACT \2\n2 TYPE Reference\n
>
> --
> Best Regards,
> Chris
>
>

-- 
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/99868774-ac2a-4ac9-9901-b7895482834dn%40googlegroups.com.


Re: Search & Replace

2021-11-15 Thread Christopher Stone
> On Nov 15, 2021, at 15:18, R B COHEN  wrote:
> 
> 1 _GCID 94D0C28F-7346-4AC7-96D1-147294BADAF1

Hey R B,

Is this the start of the line?

Are these always _GCID numbers?

Is the hyphenated alphanumeric string always 36 characters?

Something like this:

Find:

(?-i)^.*[0-9A-Z]{8}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{12}.*\n?

Replace:

Nothing

> I then need to Find & Replace:
> 
> FIND:
> 
> 1 AFN  123.123.123  
> 
> REPLACE: 
> 
> 1 FACT 123.123.123  \n
> 2 TYPE Reference

Something like this:

Find:

(\d+)\h+AFN\h+\b(\d+\.\d+\.\d+)\b

Replace:

\1 FACT \2\n2 TYPE Reference\n

--
Best Regards,
Chris

-- 
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/69FE4A06-4696-494E-9E94-157C083472D1%40gmail.com.


Search & Replace

2021-11-15 Thread R B COHEN
1 _GCID 94D0C28F-7346-4AC7-96D1-147294BADAF1
FIND: Entire line where alphanumic (with hyphen) varies per.  
REPLACE: with nothing, move next line up in its place.

Have over 61,000 of them! So once I know it works with Replace, would like 
to use Replace All.

I then need to Find & Replace:
FIND: 1 AFN  123.123.123  
REPLACE: 
1 FACT 123.123.123  \n
2 TYPE Reference
(in all cases, the alphanumeric following FACT must match the AFN )
Not sure if I need a second \n after "Reference". The example of 
"123.123.123" has two other scenarios so would run this 3 times using 
Replace & Find.

-- 
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/2ddd90ec-85d6-44d8-811c-701ce0910b18n%40googlegroups.com.


Re: Need some help with multiple search-replace Apple script

2020-12-16 Thread Christopher Stone
On 12/15/2020, at 00:42, Mathias mailto:math...@lightlabs.se>> wrote:
> Below are three example rows the way they work on Android, followed by their 
> equivalent IOS counterparts.
> 
> Switch account
> Automatic check-in to %1$s
> Choose location
> 
> 
> "switch_header" = "Switch account";
> "automaticCheckinTo" = "Automatic check-in to %@";
> "shortcut_subtitle_checkin" = "Choose location";


Hey Mathias,

Okay, that helps.

Let's start with AppleScript, since that's the way you began yourself.


# Auth: Christopher Stone
# dCre: 2020/12/17 00:01
# dMod: 2020/12/17 00:01 
# Appl: BBEdit
# Task: Android Strings to Equivalent iOS Strings.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Android, @IOS, @RegEx


tell application "BBEdit"
tell front text window

replace "([^<]+?)" using "\\1 = 
\"\\2\";" options ¬
{search mode:grep, case sensitive:false, starting at top:true}
replace "%1$s" using "%@" options {case sensitive:false, starting at 
top:true}

end tell
end tell





# Auth: Christopher Stone
# dCre: 2020/12/17 00:01
# dMod: 2020/12/17 00:03
# Appl: BBEdit
# Task: iOS Strings to Equivalent Android Strings.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Android, @IOS, @RegEx


tell application "BBEdit"
tell front text window

replace "(\"[^\"]+?\") = \"([^\"]+?)\";" using "\\2" options ¬
{search mode:grep, case sensitive:false, starting at top:true} -- 
RegEx replacement.
replace "%@" using "%1$s" options {case sensitive:false, starting at 
top:true} -- Literal replacement.

end tell
end tell




Now let's attempt some Perl:


#!/usr/bin/env perl -0777 -nw
# 
# Auth: Christopher Stone
# dCre: 2020/12/17 00:20
# dMod: 2020/12/17 00:21
# Task: Android Strings to Equivalent iOS Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @Perl
# 

s!([^<]+?)!$1 = "$2";!ig;
s!%1\$s!%@!ig;

print;

# 


#!/usr/bin/env perl -0777 -nw
# 
# Auth: Christopher Stone
# dCre: 2020/12/17 00:20
# dMod: 2020/12/17 00:28
# Task: iOS Strings to Equivalent Android Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @Perl
# 

s!("[^"]+?") = "([^"]+?)";!$2!ig;
s!%@!%1\$s!ig;

print;

# 

In this case I'm scarfing up the whole file before doing the search/replace.  
If the file was really big I'd iterate through the lines in a while loop.

Now for giggles let's trot out sed:

#!/usr/bin/env bash
# 
# Auth: Christopher Stone
# dCre: 2012/11/27 08:12
# dMod: 2020/12/17 01:05
# Task: Android Strings to Equivalent iOS Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @sed
# 

sed -En '

   s!([^<]+)!\1 = "\2";!
   s!%1\$s!%@!
   p
   
'

# 


#!/usr/bin/env bash
# 
# Auth: Christopher Stone
# dCre: 2012/11/27 08:12
# dMod: 2020/12/17 00:53 
# Task: iOS Strings to Equivalent Android Strings.
# Tags: @ccstone, @Shell, @Script, @Android, @iOS, @sed
# 

sed -En '

   s!("[^"]+") = "([^"]+)";!\2!
   s!%@!%1$s!
   p
   
'

# 


Let me know if you have any problems.

--
Best Regards,
Chris

-- 
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/DDF7E0ED-9E58-443D-9059-D0F9892A03D4%40gmail.com.


Re: Need some help with multiple search-replace Apple script

2020-12-14 Thread Mathias
Hi Chris, sure!

Below are three example rows the way they work on Android, followed by 
their equivalent IOS counterparts.

Switch account
Automatic check-in to %1$s
Choose location


"switch_header" = "Switch account";
"automaticCheckinTo" = "Automatic check-in to %@";
"shortcut_subtitle_checkin" = "Choose location";

On Monday, December 14, 2020 at 11:35:57 PM UTC+1 listmei...@gmail.com 
wrote:

> On 12/14/2020, at 07:38, Mathias  wrote:
>
> … Isn't the script expecting every row to begin with "login_infolabel" as 
> it is written right now? The variable names in the files are different on 
> every row. Or am i missing something obvious?
>
> --
>
> Hey Mathias,
>
> Please provide a more complete set of before and after examples.
>
> --
> Best Regards,
> Chris
>
>

-- 
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/0812d294-a2c9-456e-b6ad-d7504a21a250n%40googlegroups.com.


Re: Need some help with multiple search-replace Apple script

2020-12-14 Thread Christopher Stone
On 12/14/2020, at 07:38, Mathias mailto:math...@lightlabs.se>> wrote:
> … Isn't the script expecting every row to begin with "login_infolabel" as it 
> is written right now? The variable names in the files are different on every 
> row. Or am i missing something obvious?


Hey Mathias,

Please provide a more complete set of before and after examples.

--
Best Regards,
Chris

-- 
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/1C734261-A946-4677-AFD5-80BBA9EA471F%40gmail.com.


Re: Need some help with multiple search-replace Apple script

2020-12-14 Thread Mathias
Hi, work is crazy, so believe it or not, with all else going on as you 
know, I haven't had time to look at this until now.. Checking the Perl 
script, i have one question - (since my perl knowledge is very limited). 
Isn't the script expecting every row to begin with "login_infolabel" as it 
is written right now? The variable names in the files are different on 
every row. Or am i missing something obvious? Cheers

On Thursday, October 29, 2020 at 1:48:43 PM UTC+1 Mathias wrote:

> Guys, thanks a bunch for great feedback! I will take your stuff and make 
> it work i'm sure. If not i'll bother you here again! :) The reason for me 
> taking AppleScript is that i was doing stuff before i had BBEdit and i 
> kinda knew it, that's all.
>
> On Thursday, October 15, 2020 at 3:26:55 PM UTC+2 John R M. Delacour wrote:
>
>>
>>
>> On 13 Oct 2020, at 06:54, Mathias af Jochnick  
>> wrote:
>>
>> i'm trying to make 2 scripts to convert between IOS and Android i18n 
>> formats to work. I've gotten Android -> IOS to work, but the other way 
>> around is a challenge.
>>
>> Basically, for each row in a file i want to convert
>> *"login_infoLabel" = "Do you need help? Press here.”;*
>> to
>> *Do you need help? Press here.>
>> See my script below. The problem is the first search string to find the 
>> first " on each row. I spoke with Patrik at BBEdit and he kindly informed 
>> me that it was because AppleScript doesn't support grep
>>
>>
>> Patrick could not be more right!  AppleScript is not the tool for text; 
>> but BBEdit provides the Text Factory feature that allows you to use Perl 
>> (or Python, or sed) to do the work easily.
>>
>> Here is your script written in Perl:
>>
>> #! /usr/bin/perl
>> while (<>) {
>> # changes quotes round string name to §, preserving them
>> s~"(login_infoLabel)" ?= ?([^;]+);~$2~g;
>> # delete the quotes not preserved
>> s~"~~g;
>> # restore the quotes round string name
>> s~§~"~g;
>> # remove the final semicolon
>> s~;$~~;
>> # Execute the substitutions
>> print;
>> }
>>
>> This script will operate on the front window.
>>
>> How to do it—
>> 1. Open a new Text Factory (Menu: File::New...), paste in the above 
>> script, and save it as test.pl in
>> ~/Library/Application Support/BBEdit/Text Filters/
>> 2. Open the (Menu: Window::Palettes::)Text Filters palette
>> 3. Set a shortcut of you like
>> 4. Run the script (filter) with your target window frontmost.
>>
>> Notes—
>> I use "~" in the regex rather than "/".  You can use whatever you like.
>> s~found~replacement~g ;  #~g means replace all
>> Perl Regular Expressions differ from BBEdit's PRE in using $1, $2 etc 
>> rather than \1, \2
>> All the Perl knowledge you need to make the filter is:
>> a valid shebang line (should not be necessary and was not in better 
>> days!);
>> the while loop: while (<>) { .. } ;
>> a knowledge of regex in Perl, which is almost the same as BBEdit's 
>> implementation but more powerful.
>>
>> JD
>>
>>
>>
>>
>>
>>

-- 
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/ed7e6994-3520-4279-915c-9aaa888e68b1n%40googlegroups.com.


Re: Need some help with multiple search-replace Apple script

2020-10-29 Thread Mathias
Guys, thanks a bunch for great feedback! I will take your stuff and make it 
work i'm sure. If not i'll bother you here again! :) The reason for me 
taking AppleScript is that i was doing stuff before i had BBEdit and i 
kinda knew it, that's all.

On Thursday, October 15, 2020 at 3:26:55 PM UTC+2 John R M. Delacour wrote:

>
>
> On 13 Oct 2020, at 06:54, Mathias af Jochnick  wrote:
>
> i'm trying to make 2 scripts to convert between IOS and Android i18n 
> formats to work. I've gotten Android -> IOS to work, but the other way 
> around is a challenge.
>
> Basically, for each row in a file i want to convert
> *"login_infoLabel" = "Do you need help? Press here.”;*
> to
> *Do you need help? Press here.
> See my script below. The problem is the first search string to find the 
> first " on each row. I spoke with Patrik at BBEdit and he kindly informed 
> me that it was because AppleScript doesn't support grep
>
>
> Patrick could not be more right!  AppleScript is not the tool for text; 
> but BBEdit provides the Text Factory feature that allows you to use Perl 
> (or Python, or sed) to do the work easily.
>
> Here is your script written in Perl:
>
> #! /usr/bin/perl
> while (<>) {
> # changes quotes round string name to §, preserving them
> s~"(login_infoLabel)" ?= ?([^;]+);~$2~g;
> # delete the quotes not preserved
> s~"~~g;
> # restore the quotes round string name
> s~§~"~g;
> # remove the final semicolon
> s~;$~~;
> # Execute the substitutions
> print;
> }
>
> This script will operate on the front window.
>
> How to do it—
> 1. Open a new Text Factory (Menu: File::New...), paste in the above 
> script, and save it as test.pl in
> ~/Library/Application Support/BBEdit/Text Filters/
> 2. Open the (Menu: Window::Palettes::)Text Filters palette
> 3. Set a shortcut of you like
> 4. Run the script (filter) with your target window frontmost.
>
> Notes—
> I use "~" in the regex rather than "/".  You can use whatever you like.
> s~found~replacement~g ;  #~g means replace all
> Perl Regular Expressions differ from BBEdit's PRE in using $1, $2 etc 
> rather than \1, \2
> All the Perl knowledge you need to make the filter is:
> a valid shebang line (should not be necessary and was not in better days!);
> the while loop: while (<>) { .. } ;
> a knowledge of regex in Perl, which is almost the same as BBEdit's 
> implementation but more powerful.
>
> JD
>
>
>
>
>
>

-- 
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/1c77b703-3885-407d-9fcb-78f9e3113c61n%40googlegroups.com.


Re: Need some help with multiple search-replace Apple script

2020-10-15 Thread John Delacour


On 13 Oct 2020, at 06:54, Mathias af Jochnick  wrote:

> i'm trying to make 2 scripts to convert between IOS and Android i18n formats 
> to work. I've gotten Android -> IOS to work, but the other way around is a 
> challenge.
> 
> Basically, for each row in a file i want to convert
> "login_infoLabel" = "Do you need help? Press here.”;
> to
> Do you need help? Press here. 
> See my script below. The problem is the first search string to find the first 
> " on each row. I spoke with Patrik at BBEdit and he kindly informed me that 
> it was because AppleScript doesn't support grep

Patrick could not be more right!  AppleScript is not the tool for text; but 
BBEdit provides the Text Factory feature that allows you to use Perl (or 
Python, or sed) to do the work easily.

Here is your script written in Perl:

#! /usr/bin/perl
while (<>) {
# changes quotes round string name to §, preserving them
s~"(login_infoLabel)" ?= ?([^;]+);~$2~g;
# delete the quotes not preserved
s~"~~g;
# restore the quotes round string name
s~§~"~g;
# remove the final semicolon
s~;$~~;
# Execute the substitutions
print;
}

This script will operate on the front window.

How to do it—
1. Open a new Text Factory (Menu: File::New...), paste in the above script, and 
save it as test.pl in
~/Library/Application Support/BBEdit/Text Filters/
2. Open the (Menu: Window::Palettes::)Text Filters palette
3. Set a shortcut of you like
4. Run the script (filter) with your target window frontmost.

Notes—
I use "~" in the regex rather than "/".  You can use whatever you like.
s~found~replacement~g ;  #~g means replace all
Perl Regular Expressions differ from BBEdit's PRE in using $1, $2 etc rather 
than \1, \2
All the Perl knowledge you need to make the filter is:
a valid shebang line (should not be necessary and was not in better 
days!);
the while loop: while (<>) { ..  } ;
a knowledge of regex in Perl, which is almost the same as BBEdit's 
implementation but more powerful.

JD





-- 
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/74972111-C82C-41EF-9492-C3698E0B5301%40gmail.com.


Re: Need some help with multiple search-replace Apple script

2020-10-13 Thread jj
Mathias,

It would be way simpler to just use the "Find and Replace" window using the 
below regular expressions and replacement strings.

In the find window check the "Grep" and  "Wrap around" checkboxes and leave 
the other checkboxes unchecked.

If it works for your purpose in the "Find" window, you can then automate 
the process with a "Replace All" text factory: File menu > New > Text 
Factory.

*From double quotes -> tags:*

Find:

^\h*["”]((?:[^"”\\]|\\.)+?)["”]\h*=\h*["”]([^"”]+)[”"]\h*;\h*$

Replace:

\2


*From tags -> double quotes:*

Find:

^\h*([^<]+)\h*$

Replace:

"\1" = "\2";

The regular expressions are a bit complicated because they handle the 
different type of quotations marks used in your example and the case of 
escaped quotes in the strings.

If you have escaped quotes (\") in your strings, think to convert them to 
html entities () in your tag version.

HTH

Jean Jourdain


On Tuesday, October 13, 2020 at 2:12:33 PM UTC+2 Mathias wrote:

> Hi there,
> i'm trying to make 2 scripts to convert between IOS and Android i18n 
> formats to work. I've gotten Android -> IOS to work, but the other way 
> around is a challenge.
>
> Basically, for each row in a file i want to convert
> *"login_infoLabel" = "Do you need help? Press here.”;*
> to
> *Do you need help? Press here.
> See my script below. The problem is the first search string to find the 
> first " on each row. I spoke with Patrik at BBEdit and he kindly informed 
> me that it was because AppleScript doesn't support grep and that i should 
> instead record my replace with the script editor. 
>
> I did that, but now i'm at a loss as to how combine these two snippets, 
> where one is apple script and one is not?
>
> Also, the 'record' contains the actual file name, how do i make the script 
> just use the file showing in the window as i do with the apple script?
>
> If anyone could point me in the right direction, i'd be most thankful.
>
> *My replace "recording":*
> replace "^\"" using " document "untitled text 133" options {search mode:grep, starting at 
> top:true}
>
>
> *My Apple script (the first item in search_strings is what won't work):*
> set search_strings to {*"^\""*, "\" = \"", "\";"}
> set replace_strings to {"", ""}
>
> tell application "BBEdit"
> set the_string to (selection of front window as string)
> repeat with i from 1 to (count search_strings)
> set the_string to my snr(the_string, item i of search_strings, item i of 
> replace_strings)
> end repeat
> --set the clipboard to the_string
> set selection of front window to the_string
> end tell
>
> on snr(the_string, search_string, replace_string)
> tell (a reference to my text item delimiters)
> set {old_atid, contents} to {contents, search_string}
> set {the_string, contents} to {the_string's text items, replace_string}
> set {the_string, contents} to {"" & the_string, old_atid}
> end tell
> return the_string
> end snr
>
> The 'record' from BBEdit:
>
>

-- 
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/5e48a47b-282e-4ce8-9976-a871696708b5n%40googlegroups.com.


Need some help with multiple search-replace Apple script

2020-10-13 Thread Mathias af Jochnick
Hi there,
i'm trying to make 2 scripts to convert between IOS and Android i18n 
formats to work. I've gotten Android -> IOS to work, but the other way 
around is a challenge.

Basically, for each row in a file i want to convert
*"login_infoLabel" = "Do you need help? Press here.”;*
to
*Do you need help? Press here.", ""}

tell application "BBEdit"
set the_string to (selection of front window as string)
repeat with i from 1 to (count search_strings)
set the_string to my snr(the_string, item i of search_strings, item i of 
replace_strings)
end repeat
--set the clipboard to the_string
set selection of front window to the_string
end tell

on snr(the_string, search_string, replace_string)
tell (a reference to my text item delimiters)
set {old_atid, contents} to {contents, search_string}
set {the_string, contents} to {the_string's text items, replace_string}
set {the_string, contents} to {"" & the_string, old_atid}
end tell
return the_string
end snr

The 'record' from BBEdit:

-- 
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/1c337d31-e00e-441b-9da6-1c7b9fd71528n%40googlegroups.com.


Re: Help for search & replace with Grep

2020-06-12 Thread mrcmrc
I'll do for sure!

- Marco.



On Friday, June 12, 2020 at 4:37:20 PM UTC+2, Jean-Christophe Helary wrote:
>
>
>
> > On Jun 12, 2020, at 23:18, mrcmrc > 
> wrote: 
> > 
> > Thanks Jean-Christophe! It worked! 
>
> Take the time to look at the manual. It is extremely well written. 
>
> In fact, I had the exact same questions back in 96 when I first used 
> BBedit, and I decided to read the manual and everything I know about 
> regular expressions now pretty much comes from it. 
>
> So just take one or two hours to check it. Play with the search function 
> and see what you can do by yourself. 
>
>
> -- 
> Jean-Christophe Helary @brandelune 
> http://mac4translators.blogspot.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/d4d972d8-7418-48f2-ab32-ae22413486dfo%40googlegroups.com.


Re: Help for search & replace with Grep

2020-06-12 Thread mrcmrc
Thanks Fletcher, I'll take a look.

- Marco.


On Friday, June 12, 2020 at 4:40:25 PM UTC+2, flet...@cumuli.com wrote:
>
> Also, check out the Pattern Playground on the Search menu. Being able to 
> see what BBEdit is matching as you change the search pattern really helps 
> narrow in on how to make it work for your actual data. 
>
> [fletcher] 
>
>
> > On Jun 12, 2020, at 7:37 AM, Jean-Christophe Helary <
> jean.chris...@traduction-libre.org > wrote: 
> > 
> > 
> > 
> >> On Jun 12, 2020, at 23:18, mrcmrc > 
> wrote: 
> >> 
> >> Thanks Jean-Christophe! It worked! 
> > 
> > Take the time to look at the manual. It is extremely well written. 
> > 
> > In fact, I had the exact same questions back in 96 when I first used 
> BBedit, and I decided to read the manual and everything I know about 
> regular expressions now pretty much comes from it. 
> > 
> > So just take one or two hours to check it. Play with the search function 
> and see what you can do by yourself. 
> > 
> > 
> > -- 
> > Jean-Christophe Helary @brandelune 
> > http://mac4translators.blogspot.com 
> > 
> > -- 
> > 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 bbe...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/825618E2-89F9-4031-9198-2BB71EED10A0%40traduction-libre.org.
>  
>
>
>

-- 
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/fef3cff1-5110-41d6-b421-206aa79fec01o%40googlegroups.com.


Re: Help for search & replace with Grep

2020-06-12 Thread Fletcher Sandbeck
Also, check out the Pattern Playground on the Search menu. Being able to see 
what BBEdit is matching as you change the search pattern really helps narrow in 
on how to make it work for your actual data.

[fletcher]


> On Jun 12, 2020, at 7:37 AM, Jean-Christophe Helary 
>  wrote:
> 
> 
> 
>> On Jun 12, 2020, at 23:18, mrcmrc  wrote:
>> 
>> Thanks Jean-Christophe! It worked!
> 
> Take the time to look at the manual. It is extremely well written.
> 
> In fact, I had the exact same questions back in 96 when I first used BBedit, 
> and I decided to read the manual and everything I know about regular 
> expressions now pretty much comes from it.
> 
> So just take one or two hours to check it. Play with the search function and 
> see what you can do by yourself.
> 
> 
> -- 
> Jean-Christophe Helary @brandelune
> http://mac4translators.blogspot.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/825618E2-89F9-4031-9198-2BB71EED10A0%40traduction-libre.org.

-- 
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/507B4802-A546-49B8-A451-3E3869B6AFAD%40cumuli.com.


Re: Help for search & replace with Grep

2020-06-12 Thread Jean-Christophe Helary



> On Jun 12, 2020, at 23:18, mrcmrc  wrote:
> 
> Thanks Jean-Christophe! It worked!

Take the time to look at the manual. It is extremely well written.

In fact, I had the exact same questions back in 96 when I first used BBedit, 
and I decided to read the manual and everything I know about regular 
expressions now pretty much comes from it.

So just take one or two hours to check it. Play with the search function and 
see what you can do by yourself.


-- 
Jean-Christophe Helary @brandelune
http://mac4translators.blogspot.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/825618E2-89F9-4031-9198-2BB71EED10A0%40traduction-libre.org.


Re: Help for search & replace with Grep

2020-06-12 Thread mrcmrc
Thanks Jean-Christophe! It worked!

- Marco.



On Friday, June 12, 2020 at 3:39:42 PM UTC+2, Jean-Christophe Helary wrote:
>
>
>
> > On Jun 12, 2020, at 18:56, mrcmrc > 
> wrote: 
> > 
> > Hi, 
> > someone may help me? Usually I can do some very simple replacements, but 
> I don't have great experience with Grep syntax... 
> > 
> > I have a block of text like this: 
> > 
> > Miles Davis – trumpet 
> > John Coltrane – tenor saxophone 
> > Red Garland – piano 
> > Paul Chambers – double bass 
> > Philly Joe Jones – drumset 
> > 
> > and wish to get this: 
> > 
> > Miles Davis, John Coltrane, Red Garland, Paul Chambers, Philly Joe Jones 
>
> Search: 
>
>  – .*\n 
>
> Replace: 
>
> , 
>
> there is a space at the beginning of the search string 
> and one at the end of the replace one. 
>
>
> -- 
> Jean-Christophe Helary @brandelune 
> http://mac4translators.blogspot.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/7bf0e354-615b-47fd-bf2f-cfbb6cabb695o%40googlegroups.com.


Re: Help for search & replace with Grep

2020-06-12 Thread Jean-Christophe Helary



> On Jun 12, 2020, at 18:56, mrcmrc  wrote:
> 
> Hi,
> someone may help me? Usually I can do some very simple replacements, but I 
> don't have great experience with Grep syntax...
> 
> I have a block of text like this:
> 
> Miles Davis – trumpet
> John Coltrane – tenor saxophone
> Red Garland – piano
> Paul Chambers – double bass
> Philly Joe Jones – drumset
> 
> and wish to get this:
> 
> Miles Davis, John Coltrane, Red Garland, Paul Chambers, Philly Joe Jones

Search:

 – .*\n

Replace:

, 

there is a space at the beginning of the search string
and one at the end of the replace one.


-- 
Jean-Christophe Helary @brandelune
http://mac4translators.blogspot.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/C68AAB2D-E41D-4DBC-A02E-FF609A133A7A%40traduction-libre.org.


Help for search & replace with Grep

2020-06-12 Thread mrcmrc
Hi,
someone may help me? Usually I can do some very simple replacements, but I 
don't have great experience with Grep syntax...

I have a block of text like this:

Miles Davis – trumpet
John Coltrane – tenor saxophone
Red Garland – piano
Paul Chambers – double bass
Philly Joe Jones – drumset

and wish to get this:

Miles Davis, John Coltrane, Red Garland, Paul Chambers, Philly Joe Jones

Thanks for any help!


-- 
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/e213ef30-9766-48d2-9465-9df9b5737719o%40googlegroups.com.


Re: Search/Replace with GREP wildcards

2019-12-23 Thread Charles Nichols
Thank you very much.  That worked perfectly.

Charles Nichols
www.charlesnichols.com


On Mon, Dec 23, 2019 at 12:58 PM Massimo Rainato 
wrote:

> In a 3 step yes.
> 1) change first part fix with 
> 2) change lastpart with 
> 3) change (.*) with none
>
> Il giorno lun 23 dic 2019 alle 17:45 Charles Nichols <
> csnichol...@gmail.com> ha scritto:
>
>> Is it possible to find and delete every instance of
>>
>> > class="internal">Program (PDF)
>>
>> in a file, using wildcards instead of "20141201-IlPreteDISIS", which is a
>> name of a PDF, that will be different for each instance, but always in the
>> pattern "Date-Name"?
>>
>> On Wednesday, May 18, 2016 at 6:20:32 PM UTC-4, Christopher Stone wrote:
>>>
>>> On May 18, 2016, at 15:20, Steve Piercy  wrote:
>>>
>>> Another option is the BBEdit reference "Searching with Grep", which I
>>> bookmarked and view in a web browser because the Apple Help viewer has a
>>> terrible UI.
>>>
>>> __
>>>
>>> Hey Steve,
>>>
>>> Good idea, although not everyone will place BBEdit in the /Applications
>>> folder.
>>>
>>> Here's how to script it and let the OSX find the app for you.
>>>
>>> --
>>> Best Regards,
>>> Chris
>>>
>>>
>>> ---
>>> # Auth: Christopher Stone
>>> # dCre: 2016/05/18 17:08
>>> # dMod: 2016/05/18 17:13
>>> # Appl: BBEdit & Safari
>>> # Task: Open BBEdit's “Searching with Grep” Chapter in Safari
>>> # Tags: @Applescript, @Script, @, BBEdit, @Safari, @Open, @Help
>>>
>>> ---
>>>
>>> *set* grepHelp *to* "/Contents/Resources/BBEdit%20Help/index_grep.htm"
>>> *set* shCMD *to* "mdfind -onlyin /Applications/
>>> 'kMDItemCFBundleIdentifier == \"com.barebones.bbedit\"'"
>>> *set* bbeditApp *to* *do shell script* shCMD
>>> *set* grepHelpPath *to* "file://" & bbeditApp & grepHelp
>>>
>>> *tell* *application* "Safari"
>>>   *activate*
>>>   *make* new *document* with properties {URL:grepHelpPath}
>>>   # My preferred window location and size – change to suit.
>>>   *set* bounds *of* *front* *window* *to* {228, 23, 1542, 1196}
>>> *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 to the group.
>> 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/e4942cb5-422f-4be9-8f4c-28523f55d038%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 to the group.
> 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/CAK3epCE6sHiRGa_E6b5vF%3D_R6OfoHuTkdm-DLVp-m4zFxc-hbA%40mail.gmail.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 to the group.
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/CAB0XdwBNX072nWi3Ds30cPX9j-VAhXMXXDexYkZyFaZZWTo_WA%40mail.gmail.com.


Re: Search/Replace with GREP wildcards

2019-12-23 Thread Sam Hathaway

On 23 Dec 2019, at 11:44, Charles Nichols wrote:


Is it possible to find and delete every instance of

Program (PDF)

in a file, using wildcards instead of "20141201-IlPreteDISIS", which 
is a
name of a PDF, that will be different for each instance, but always in 
the

pattern "Date-Name"?


Yes, using this Grep pattern:

`class="internal">Program \(PDF\)`


Assumptions:

* the “Date” will always consist of one or more digits (`\d+`).
* the “Name” will always consist of one or more word characters 
(`\w+`).

* the link text will always be “Program (PDF)”.

Hope this helps.
-sam

--
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 to the group.
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/9A2B15D2-0AD0-40CB-A359-767BD824CBAD%40munkynet.org.


Re: Search/Replace with GREP wildcards

2019-12-23 Thread Massimo Rainato
In a 3 step yes.
1) change first part fix with 
2) change lastpart with 
3) change (.*) with none

Il giorno lun 23 dic 2019 alle 17:45 Charles Nichols 
ha scritto:

> Is it possible to find and delete every instance of
>
>  class="internal">Program (PDF)
>
> in a file, using wildcards instead of "20141201-IlPreteDISIS", which is a
> name of a PDF, that will be different for each instance, but always in the
> pattern "Date-Name"?
>
> On Wednesday, May 18, 2016 at 6:20:32 PM UTC-4, Christopher Stone wrote:
>>
>> On May 18, 2016, at 15:20, Steve Piercy  wrote:
>>
>> Another option is the BBEdit reference "Searching with Grep", which I
>> bookmarked and view in a web browser because the Apple Help viewer has a
>> terrible UI.
>>
>> __
>>
>> Hey Steve,
>>
>> Good idea, although not everyone will place BBEdit in the /Applications
>> folder.
>>
>> Here's how to script it and let the OSX find the app for you.
>>
>> --
>> Best Regards,
>> Chris
>>
>>
>> ---
>> # Auth: Christopher Stone
>> # dCre: 2016/05/18 17:08
>> # dMod: 2016/05/18 17:13
>> # Appl: BBEdit & Safari
>> # Task: Open BBEdit's “Searching with Grep” Chapter in Safari
>> # Tags: @Applescript, @Script, @, BBEdit, @Safari, @Open, @Help
>>
>> ---
>>
>> *set* grepHelp *to* "/Contents/Resources/BBEdit%20Help/index_grep.htm"
>> *set* shCMD *to* "mdfind -onlyin /Applications/
>> 'kMDItemCFBundleIdentifier == \"com.barebones.bbedit\"'"
>> *set* bbeditApp *to* *do shell script* shCMD
>> *set* grepHelpPath *to* "file://" & bbeditApp & grepHelp
>>
>> *tell* *application* "Safari"
>>   *activate*
>>   *make* new *document* with properties {URL:grepHelpPath}
>>   # My preferred window location and size – change to suit.
>>   *set* bounds *of* *front* *window* *to* {228, 23, 1542, 1196}
>> *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 to the group.
> 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/e4942cb5-422f-4be9-8f4c-28523f55d038%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 to the group.
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/CAK3epCE6sHiRGa_E6b5vF%3D_R6OfoHuTkdm-DLVp-m4zFxc-hbA%40mail.gmail.com.


Re: Search/Replace with GREP wildcards

2019-12-23 Thread Charles Nichols
Is it possible to find and delete every instance of  

Program (PDF)

in a file, using wildcards instead of "20141201-IlPreteDISIS", which is a 
name of a PDF, that will be different for each instance, but always in the 
pattern "Date-Name"?

On Wednesday, May 18, 2016 at 6:20:32 PM UTC-4, Christopher Stone wrote:
>
> On May 18, 2016, at 15:20, Steve Piercy  > wrote:
>
> Another option is the BBEdit reference "Searching with Grep", which I 
> bookmarked and view in a web browser because the Apple Help viewer has a 
> terrible UI.
>
> __
>
> Hey Steve,
>
> Good idea, although not everyone will place BBEdit in the /Applications 
> folder.
>
> Here's how to script it and let the OSX find the app for you.
>
> --
> Best Regards,
> Chris
>
>
> ---
> # Auth: Christopher Stone
> # dCre: 2016/05/18 17:08
> # dMod: 2016/05/18 17:13 
> # Appl: BBEdit & Safari
> # Task: Open BBEdit's “Searching with Grep” Chapter in Safari
> # Tags: @Applescript, @Script, @, BBEdit, @Safari, @Open, @Help
>
> ---
>
> *set* grepHelp *to* "/Contents/Resources/BBEdit%20Help/index_grep.htm"
> *set* shCMD *to* "mdfind -onlyin /Applications/ 
> 'kMDItemCFBundleIdentifier == \"com.barebones.bbedit\"'"
> *set* bbeditApp *to* *do shell script* shCMD
> *set* grepHelpPath *to* "file://" & bbeditApp & grepHelp
>
> *tell* *application* "Safari"
>   *activate*
>   *make* new *document* with properties {URL:grepHelpPath}
>   # My preferred window location and size – change to suit.
>   *set* bounds *of* *front* *window* *to* {228, 23, 1542, 1196}
> *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 to the group.
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/e4942cb5-422f-4be9-8f4c-28523f55d038%40googlegroups.com.


Re: Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-04 Thread Kerri Hicks
You've gotten some good answers about how to do precisely what you say you
want to do, and that's great.

I'm curious, though, if you might want something different. When you're
working with a CSV, enclosing a field in double-quotation marks
preserves/respects the commas within that field. If you remove the commas
completely, or replace the commas with something else, as you've requested,
it will degrade the quality of your data. (That might not matter to you in
this case.)

So instead of finding everything between "ArtToCanvas" and
"ArtToCanvas,prints" and removing the commas from it, I'd find the first

ArtToCanvas,

and replace it with

ArtToCanvas,"

and then find the second

,ArtToCanvas

and replace it with

",ArtToCanvas

Hope this helps.
--Kerri

On Mon, Jun 3, 2019 at 9:34 AM Aethon  wrote:

> I have a big file that I had exported from the office as a CSV (forgetting
> that I had done the first part a while back as tab-separated).
>
> So now I have a list where some of the text columns contains commas and
> this throws the whole structure/order off.
>
> Here is a sample of the data.
>
>
> home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : Sea
> Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,
> https://arttocanvas.com
> home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches :
> Gold Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,
> https://arttocanvas.com
> home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H
> inches : Blue, Green, and Brown by Mark Rothko*
> ,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
> home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x
> 26H inches : La seperazione dellatomo by Salvador Dali*
> ,ArtToCanvas,prints,299,,,1,https://arttocanvas.com
>
> Now, what I want is to replace the commas from the centre column (in bold).
>
> I had use a grep search like the following :
>
> ArtToCanvas,(.+),ArtToCanvas,prints
>
>
> to select the correct information—but I don't know to do a further
> replacement of the commas when I output the \1.
>
>
> Is this even possible using  Bbedit Grep?
>
> I have version 10.5.3
>
> Thanks,
> George
>
> --
> 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 to the group.
> 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 post to this group, send email to bbedit@googlegroups.com.
> Visit this group at https://groups.google.com/group/bbedit.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/e548236e-c87a-4c5c-9544-7c46b8588ada%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 to the group.
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 post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CAEmA4uYt5QBHG3ayKc6cHFCUpcD3wGr_f4TFM_KxUYQ2x%2BSLcQ%40mail.gmail.com.


Re: Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-04 Thread 'John Springer' via BBEdit Talk
Here's another way to deal with it.  You had 11 columns all together.  The 
first 3 are comma-delimited.  So are the last 7.  Column four is the one 
that may have additional commas in it.  You can restore the columns like 
this:
Find:
^(.*?),(.*?),(.*?),(.*),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?)$
3 fields separated by commas, another field that can be any length, 
followed by 7 fields separated by commas.  The fourth column, commas and 
all, will end up in the 4th match field.

Replace:
Replace each field.  I used tabs, and also surrounded col 4 with pipes to 
so I could see that commas were captured.  
\1\t\2\t\3\t|\4|\t\5\t\6t\7t\8t\9t\10t\11


On Monday, June 3, 2019 at 6:34:03 AM UTC-7, Aethon wrote:
>
> I have a big file that I had exported from the office as a CSV (forgetting 
> that I had done the first part a while back as tab-separated).
>
> So now I have a list where some of the text columns contains commas and 
> this throws the whole structure/order off.
>
> Here is a sample of the data.
>
>
> home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : Sea 
> Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,
> https://arttocanvas.com
> home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches : 
> Gold Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,
> https://arttocanvas.com
> home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H 
> inches : Blue, Green, and Brown by Mark Rothko*
> ,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
> home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x 
> 26H inches : La seperazione dellatomo by Salvador Dali*
> ,ArtToCanvas,prints,299,,,1,https://arttocanvas.com
>
> Now, what I want is to replace the commas from the centre column (in bold).
>
> I had use a grep search like the following :
>
> ArtToCanvas,(.+),ArtToCanvas,prints 
>
>
> to select the correct information—but I don't know to do a further 
> replacement of the commas when I output the \1.
>
>
> Is this even possible using  Bbedit Grep?
>
> I have version 10.5.3
>
> Thanks,
> George
>

-- 
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 to the group.
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 post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/858cab8f-b35b-408f-959e-3e7a34a6692c%40googlegroups.com.


Re: Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-03 Thread Aethon
That is simple and clever.  Thanks man!

-George

On Monday, June 3, 2019 at 10:30:33 AM UTC-4, ThePorgie wrote:
>
> In your sample data would the patten be inconsistent regarding the number 
> of commas that need to be replaced? I'm thinking that might be the case 
> looking at your sample...Also if you want to replace the commas in the 
> bolded copy what is it you want to replace them with?
>
> Not knowing the number of commas I might choose to use Quotes to ID the 
> copy with a grep string like
>
> find:
> (?<=ArtToCanvas,)(.+)(?=,ArtToCanvas,prints,)
> replace:
> "\1"
>
> Parts explained **Look ahead and look behind are not found and therefor 
> are not captured.
> (?<=ArtToCanvas,) Positive look behind
> (.+) Captured copy
> (?=,ArtToCanvas,prints,) Positive look ahead
>
> This will put Quotes around your copy at which point you would be able to 
> replace just the commas between the quotes or import into Excel or most 
> other apps as the structure should be correct for dealing with the commas 
> in the string.
>
>
> Hope that helps
> -George
>
> On Monday, June 3, 2019 at 9:34:03 AM UTC-4, Aethon wrote:
>>
>> I have a big file that I had exported from the office as a CSV 
>> (forgetting that I had done the first part a while back as tab-separated).
>>
>> So now I have a list where some of the text columns contains commas and 
>> this throws the whole structure/order off.
>>
>> Here is a sample of the data.
>>
>>
>> home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : 
>> Sea Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,
>> https://arttocanvas.com
>> home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches : 
>> Gold Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,
>> https://arttocanvas.com
>> home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H 
>> inches : Blue, Green, and Brown by Mark Rothko*
>> ,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
>> home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x 
>> 26H inches : La seperazione dellatomo by Salvador Dali*
>> ,ArtToCanvas,prints,299,,,1,https://arttocanvas.com
>>
>> Now, what I want is to replace the commas from the centre column (in 
>> bold).
>>
>> I had use a grep search like the following :
>>
>> ArtToCanvas,(.+),ArtToCanvas,prints 
>>
>>
>> to select the correct information—but I don't know to do a further 
>> replacement of the commas when I output the \1.
>>
>>
>> Is this even possible using  Bbedit Grep?
>>
>> I have version 10.5.3
>>
>> Thanks,
>> George
>>
>

-- 
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 to the group.
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 post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/5d5b1eab-e130-4c0b-8ca2-5b99d9c9286b%40googlegroups.com.


Re: Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-03 Thread ThePorgie
In your sample data would the patten be inconsistent regarding the number 
of commas that need to be replaced? I'm thinking that might be the case 
looking at your sample...Also if you want to replace the commas in the 
bolded copy what is it you want to replace them with?

Not knowing the number of commas I might choose to use Quotes to ID the 
copy with a grep string like

find:
(?<=ArtToCanvas,)(.+)(?=,ArtToCanvas,prints,)
replace:
"\1"

Parts explained **Look ahead and look behind are not found and therefor are 
not captured.
(?<=ArtToCanvas,) Positive look behind
(.+) Captured copy
(?=,ArtToCanvas,prints,) Positive look ahead

This will put Quotes around your copy at which point you would be able to 
replace just the commas between the quotes or import into Excel or most 
other apps as the structure should be correct for dealing with the commas 
in the string.


Hope that helps
-George

On Monday, June 3, 2019 at 9:34:03 AM UTC-4, Aethon wrote:
>
> I have a big file that I had exported from the office as a CSV (forgetting 
> that I had done the first part a while back as tab-separated).
>
> So now I have a list where some of the text columns contains commas and 
> this throws the whole structure/order off.
>
> Here is a sample of the data.
>
>
> home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : Sea 
> Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,
> https://arttocanvas.com
> home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches : 
> Gold Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,
> https://arttocanvas.com
> home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H 
> inches : Blue, Green, and Brown by Mark Rothko*
> ,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
> home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x 
> 26H inches : La seperazione dellatomo by Salvador Dali*
> ,ArtToCanvas,prints,299,,,1,https://arttocanvas.com
>
> Now, what I want is to replace the commas from the centre column (in bold).
>
> I had use a grep search like the following :
>
> ArtToCanvas,(.+),ArtToCanvas,prints 
>
>
> to select the correct information—but I don't know to do a further 
> replacement of the commas when I output the \1.
>
>
> Is this even possible using  Bbedit Grep?
>
> I have version 10.5.3
>
> Thanks,
> George
>

-- 
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 to the group.
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 post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/d889a4a4-3de0-467c-af9b-90658d885aea%40googlegroups.com.


Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-03 Thread Aethon
I have a big file that I had exported from the office as a CSV (forgetting 
that I had done the first part a while back as tab-separated).

So now I have a list where some of the text columns contains commas and 
this throws the whole structure/order off.

Here is a sample of the data.


home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : Sea 
Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,https://arttocanvas.com
home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches : Gold 
Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,https://arttocanvas.com
home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H inches 
: Blue, Green, and Brown by Mark Rothko*
,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x 26H 
inches : La seperazione dellatomo by Salvador Dali*
,ArtToCanvas,prints,299,,,1,https://arttocanvas.com

Now, what I want is to replace the commas from the centre column (in bold).

I had use a grep search like the following :

ArtToCanvas,(.+),ArtToCanvas,prints 


to select the correct information—but I don't know to do a further 
replacement of the commas when I output the \1.


Is this even possible using  Bbedit Grep?

I have version 10.5.3

Thanks,
George

-- 
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 to the group.
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 post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/e548236e-c87a-4c5c-9544-7c46b8588ada%40googlegroups.com.


Re: Wildcard on search/replace

2018-01-30 Thread Tom Robinson
Yep :]

Though you’re not doing anything with the text inside the tags, so it’s 
redundant to capture it (with the brackets):

.*?


> On 2018-01-31, at 09:12, Jaime Guitart Vilches  
> wrote:
> 
> What I really would like to do is to erase anything between those tags 
> (including the tags themselves), so I understand I would have to use this:
> 
> Find: (.*?)
> Replace: [and here leave blank]

-- 
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: 
--- 
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.


Re: Wildcard on search/replace

2018-01-30 Thread Patrick Woolsey
On 1/30/18 at 3:12 PM, jaime.guit...@gmail.com (Jaime Guitart 
Vilches) wrote:


What I really would like to do is to erase anything between 
those tags (including the tags themselves), so I understand I 
would have to use this:


Find: (.*?)
Replace: [and here leave blank]



That should do the job, unless the contents of these tags span a 
hard line break, in which case this slight variation will handle same:


Find:((?s).*?)

Replace: [leave this field empty]



Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc. 

--
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: 
--- 
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.


Re: Wildcard on search/replace

2018-01-30 Thread Jaime Guitart Vilches
Well this may be very helpful, thank you very much.

What I really would like to do is to erase anything between those tags 
(including the tags themselves), so I understand I would have to use this:

Find: (.*?)
Replace: [and here leave blank]

I am very thankful, if this works you've just saved me hours of work!

Best,
Jaime

-- 
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: 
--- 
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.


Re: Wildcard on search/replace

2018-01-30 Thread Fletcher Sandbeck
I would add to look at the "Grep Reference" in BBEdit Help for documentation of 
the syntax. Grep is like wildcards on steroids.

[fletcher]


> On Jan 30, 2018, at 6:31 AM, Kerri Hicks  wrote:
> 
> Well, it depends on what you want to do to those  elements. But here's an 
> example (and note the "grep" box is checked at the bottom). This will take 
> the string
> 
>  this is what the number 5 looks like
> 
> and will return
> 
>  this is what the number  looks like
> 
> Does that help at all? More info about what you want to do with text between 
> the tags might be helpful, too.
> 
>  
> ​
> ​--Kerri
> 
> On Tue, Jan 30, 2018 at 8:01 AM, Jaime Guitart Vilches 
> > wrote:
> Hello
> I'm new to this and I hope I can get some help with what I expect/hope to be 
> a basic lack of knowledge on my side...
> I'm editing a large database and I need to replace a series of strings that 
> are clearly delimited with tags .
> I'm wondering if there's a wildcard character I can use to search for 
> anything contained between those tags?
> I've tried * and ? but it doesn't seem to work.
> It would save me SO much time...
> Thanks in advance,
> Jaime
> 
> -- 
> 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:  >
> --- 
> 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 
> .
> 
> 
> -- 
> 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:  >
> --- 
> 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 
> .

-- 
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: 
--- 
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.


Re: Wildcard on search/replace

2018-01-30 Thread Kerri Hicks
Well, it depends on what you want to do to those  elements. But here's
an example (and note the "grep" box is checked at the bottom). This will
take the string

 this is what the number 5 looks like

and will return

 this is what the number  looks like

Does that help at all? More info about what you want to do with text
between the tags might be helpful, too.


​
​--Kerri

On Tue, Jan 30, 2018 at 8:01 AM, Jaime Guitart Vilches <
jaime.guit...@gmail.com> wrote:

> Hello
> I'm new to this and I hope I can get some help with what I expect/hope to
> be a basic lack of knowledge on my side...
> I'm editing a large database and I need to replace a series of strings
> that are clearly delimited with tags .
> I'm wondering if there's a wildcard character I can use to search for
> anything contained between those tags?
> I've tried * and ? but it doesn't seem to work.
> It would save me SO much time...
> Thanks in advance,
> Jaime
>
> --
> 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: 
> ---
> 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.
>

-- 
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: 
--- 
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.


Wildcard on search/replace

2018-01-30 Thread Jaime Guitart Vilches
Hello
I'm new to this and I hope I can get some help with what I expect/hope to 
be a basic lack of knowledge on my side...
I'm editing a large database and I need to replace a series of strings that 
are clearly delimited with tags .
I'm wondering if there's a wildcard character I can use to search for 
anything contained between those tags?
I've tried * and ? but it doesn't seem to work.
It would save me SO much time...
Thanks in advance,
Jaime

-- 
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: 
--- 
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.


Re: search replace wildcard

2017-10-14 Thread Oliver Boermans
Hi Sharb, try this (with [✓] Grep)

Search:
'[A-Z]

Replace:
'a

where [A-Z] will match any single uppercase letter

On 14 October 2017 at 14:48, Sharb  wrote:

> I can't get basic wildcard \w to work in Find/Replace, but might be doing
> something very basic incorrectly.
> I'm brand new to this work and am working my way through Practical
> Computing for Biologists. My Mac is OS X El Capitan 10.11.6 and I've
> downloaded BBEdit as TextWrangler (the book's focus) is being 'sunsetted'.
> I've tried . (dot), but can't get it to work.
> Example:
> +40 46'N +014 15'E
> +21 17'N -157 52'W
> I tried Find '\w and Replace 'a (to replace all letters with a)
>
> --
> 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: 
> ---
> 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.
>

-- 
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: 
--- 
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.


search replace wildcard

2017-10-14 Thread Sharb
I can't get basic wildcard \w to work in Find/Replace, but might be doing 
something very basic incorrectly.
I'm brand new to this work and am working my way through Practical 
Computing for Biologists. My Mac is OS X El Capitan 10.11.6 and I've 
downloaded BBEdit as TextWrangler (the book's focus) is being 'sunsetted'.  
I've tried . (dot), but can't get it to work.
Example: 
+40 46'N +014 15'E
+21 17'N -157 52'W
I tried Find '\w and Replace 'a (to replace all letters with a)

-- 
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: 
--- 
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.


Re: Customer post: How to quickly create html form-fields via grep search & replace

2017-02-25 Thread Bruce Linde
here are some canned/stored grep patterns i use all the time... i have a 
bunch. all of the ones related to forms start with FORMS:, all of the one 
related to php start with PHP:, etc.



FORMS: generate radio buttons
   USAGE: any amount of field names, one per line. select all and then 
REPLACE ALL - selection only
   FIND: ^([^\r]+)\r
   REPLACE ALL:  Yes\r No\r\r

SUCH AS:
do i love bbedit?
could i imagine using any other program than bbedit?
where's my winning lottery ticket already?!?!?

WHICH RESULTS IN:

 Yes
 No

 Yes
 No

 Yes
 No





FORMS: init post vars from a list of field names
   USAGE: any amount of field names, one per line. select all and then 
REPLACE ALL - selection only
   FIND: ^([^\r]+)\r
   REPLACE ALL: \tif ( isset($_POST['\1']) ) {\r\t\t$\1 = 
$_POST['\1'];\r\t} else {\r\t\t$\1 = "";\r\t}\r\r

SUCH AS:
wombat
toaster_oven
lumbago

WHICH RESULTS IN:

if ( isset($_POST['wombat']) ) {
$wombat = $_POST['wombat'];
} else {
$wombat = "";
}

if ( isset($_POST['toaster_oven']) ) {
$toaster_oven = $_POST['toaster_oven'];
} else {
$toaster_oven = "";
}

if ( isset($_POST['lumbago']) ) {
$lumbago = $_POST['lumbago'];
} else {
$lumbago = "";
}






FORMS: init post AND session vars from a list of field names
   USAGE: any amount of field names, one per line. select all and then 
REPLACE ALL - selection only
   FIND: ^(.+)\r
   REPLACE ALL: \t$the_\1 = $_POST['\1'];\r\t\t$_SESSION['\1'] = \$the_\1;\r

SUCH AS:
wombat
toaster_oven
lumbago

WHICH RESULTS IN:

$the_wombat = $_POST['wombat'];
$_SESSION['wombat'] = $the_wombat;
$the_toaster_oven = $_POST['toaster_oven'];
$_SESSION['toaster_oven'] = $the_toaster_oven;
$the_lumbago = $_POST['lumbago'];
$_SESSION['lumbago'] = $the_lumbago;








On Thursday, February 23, 2017 at 11:53:14 AM UTC-8, Patrick Woolsey wrote:
>
> Good afternoon folks, 
>
> We just heard from a customer who's written a handy tutorial 
> about creating HTML form fields using BBEdit, so I'm posting a 
> link here for anyone who may find this helpful: 
>
> How to quickly create html form-fields using BBEdit’s GREP 
> search and replace function -- by Ole Kristian Ek Hornnes: 
>
> <
> https://tech.humlesite.eu/2017/02/21/how-to-quickly-create-html-form-fields-using-bbedits-grep-search-and-replace-function/>
>  
>
>
>
> Regards, 
>
>   Patrick Woolsey 
> == 
> Bare Bones Software, Inc.  
>
>

-- 
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: 
--- 
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.


Re: Customer post: How to quickly create html form-fields via grep search & replace

2017-02-25 Thread Rick Yentzer
That was really helpful. If also gives ideas for other ways to use grep and 
replace together in html and the like.


On Thursday, February 23, 2017 at 2:53:14 PM UTC-5, Patrick Woolsey wrote:
>
> Good afternoon folks, 
>
> We just heard from a customer who's written a handy tutorial 
> about creating HTML form fields using BBEdit, so I'm posting a 
> link here for anyone who may find this helpful: 
>
> How to quickly create html form-fields using BBEdit’s GREP 
> search and replace function -- by Ole Kristian Ek Hornnes: 
>
> <
> https://tech.humlesite.eu/2017/02/21/how-to-quickly-create-html-form-fields-using-bbedits-grep-search-and-replace-function/>
>  
>
>
>
> Regards, 
>
>   Patrick Woolsey 
> == 
> Bare Bones Software, Inc.  
>
>

-- 
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: 
--- 
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.


Customer post: How to quickly create html form-fields via grep search & replace

2017-02-23 Thread Patrick Woolsey

Good afternoon folks,

We just heard from a customer who's written a handy tutorial 
about creating HTML form fields using BBEdit, so I'm posting a 
link here for anyone who may find this helpful:


How to quickly create html form-fields using BBEdit’s GREP 
search and replace function -- by Ole Kristian Ek Hornnes:





Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc. 

--
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: 
--- 
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.


Re: Search/Replace with GREP wildcards

2016-05-18 Thread Christopher Stone
On May 18, 2016, at 15:20, Steve Piercy  wrote:
> Another option is the BBEdit reference "Searching with Grep", which I 
> bookmarked and view in a web browser because the Apple Help viewer has a 
> terrible UI.
__

Hey Steve,

Good idea, although not everyone will place BBEdit in the /Applications folder.

Here's how to script it and let the OSX find the app for you.

--
Best Regards,
Chris

---
# Auth: Christopher Stone
# dCre: 2016/05/18 17:08
# dMod: 2016/05/18 17:13 
# Appl: BBEdit & Safari
# Task: Open BBEdit's “Searching with Grep” Chapter in Safari
# Tags: @Applescript, @Script, @, BBEdit, @Safari, @Open, @Help
---

set grepHelp to "/Contents/Resources/BBEdit%20Help/index_grep.htm"
set shCMD to "mdfind -onlyin /Applications/ 'kMDItemCFBundleIdentifier == 
\"com.barebones.bbedit\"'"
set bbeditApp to do shell script shCMD
set grepHelpPath to "file://" & bbeditApp & grepHelp

tell application "Safari"
  activate
  make new document with properties {URL:grepHelpPath}
  # My preferred window location and size – change to suit.
  set bounds of front window to {228, 23, 1542, 1196}
end tell

---

-- 
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: 

--- 
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/Replace with GREP wildcards

2016-05-18 Thread Luis Speciale

Le 18/05/2016 à 22:20, Steve Piercy a écrit :

On 5/18/16 at 3:11 PM, listmeis...@suddenlink.net (Christopher Stone)
pronounced:


On May 18, 2016, at 13:08, 1611mac <1611...@gmail.com> wrote:

Awesome!  I learned a lot just from that one simple little blurb!

__



BBEdit-TextWrangler_RegEx_Cheat_Sheet:

https://gist.github.com/ccstone/5385334


Another option is the BBEdit reference "Searching with Grep", which I
bookmarked and view in a web browser because the Apple Help viewer has a
terrible UI.
file:///Applications/BBEdit.app/Contents/Resources/BBEdit%20Help/index_grep.htm


I also use this tool a lot.  The live preview is quick, and the
community around it shares common regexes.
https://regex101.com/


And there's also

https://github.com/aurbano/regex101-osx

https://github.com/ibaaj/Regex101.com-offline-app

and some discussion here

https://github.com/firasdib/Regex101/issues/76

--
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: 

--- 
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/Replace with GREP wildcards

2016-05-18 Thread Steve Piercy
On 5/18/16 at 3:11 PM, listmeis...@suddenlink.net (Christopher 
Stone) pronounced:



On May 18, 2016, at 13:08, 1611mac <1611...@gmail.com> wrote:

Awesome!  I learned a lot just from that one simple little blurb!

__



BBEdit-TextWrangler_RegEx_Cheat_Sheet:

https://gist.github.com/ccstone/5385334


Another option is the BBEdit reference "Searching with Grep", 
which I bookmarked and view in a web browser because the Apple 
Help viewer has a terrible UI.

file:///Applications/BBEdit.app/Contents/Resources/BBEdit%20Help/index_grep.htm

I also use this tool a lot.  The live preview is quick, and the 
community around it shares common regexes.

https://regex101.com/

--steve


Steve Piercy, Soquel, CA

--
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: 

--- 
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/Replace with GREP wildcards

2016-05-18 Thread 1611mac
Awesome!  I learned a lot just from that one simple little blurb!  Thank 
you very much!  Perfect!  Over 4k lines changed in a couple seconds!

On Wednesday, May 18, 2016 at 1:37:54 PM UTC-4, Sam H. wrote:
>
> Hi, 
>
> Find: ="#(.*)" 
> Replace: ="#\U\1\E" 
>
> Hope this helps. 
> -sam 
>
> On 18 May 2016, at 1:27 PM EDT, 1611mac wrote: 
>
> > Is it possible to "Replace" wildcard strings? 
> > 
> > For example, given this "FIND" string entered in Find and Replace:   
> > ="#.*" 
> > 
> > How would I "REPLACE" the wildcard text found with the same text set 
> > in all 
> > caps? 
> > 
> > 
> > Example: 
> > ="#foo"  becomes ="#FOO" 
> > 
> > 
> > 
> > 
> > -- 
> > 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:  
> > 
> > --- 
> > 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 
> . 
>

-- 
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: 

--- 
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.


Search/Replace with GREP wildcards

2016-05-18 Thread 1611mac
Is it possible to "Replace" wildcard strings?

For example, given this "FIND" string entered in Find and Replace:  ="#.*"  

How would I "REPLACE" the wildcard text found with the same text set in all 
caps?


Example:
="#foo"  becomes ="#FOO"




-- 
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: 

--- 
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: Text Factory search/replace ignores content.opf file in ePubs?

2014-12-20 Thread Robert A. Rosenberg
At 16:37 -0800 on 12/19/2014, Heulwen Jones wrote about Text Factory 
search/replace ignores content.opf file in ePu:



Hi there,

I produce ePubs from Adobe InDesign CC. I then open the ePub in 
BBEdit (version 10.5.12) and run a number of 'cleanup' 
search/replaces across the ePub using BBEdit Text Factories.


This works well except that the search/replaces always ignore the 
content.opf file i.e.. no changes are made to the content.opf file 
even though I've tested my search/replace strings and they should 
make changes to that file?


I've tried running the text factory using  'all file types' as well 
as 'text files only' but it still doesn't work.


Is anyone else having this problem or know how to solve it?

Many thanks,

Heulwen



While others are looking into the question of why that file is being 
ignored when you open the ePub have you tried the bypass of directly 
opening the content.opf file to see if it opens? If it does not, you 
have your answer. If it does, try running the Text Factory against 
the file and see what happens. If that latter works, you have a 
working bypass to use while the fix for the ePub issue is being 
addressed.


--
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.


Text Factory search/replace ignores content.opf file in ePubs?

2014-12-19 Thread Heulwen Jones
Hi there,

I produce ePubs from Adobe InDesign CC. I then open the ePub in BBEdit 
(version 10.5.12) and run a number of 'cleanup' search/replaces across the 
ePub using BBEdit Text Factories.

This works well except that the search/replaces always ignore the 
content.opf file i.e.. no changes are made to the content.opf file even 
though I've tested my search/replace strings and they should make changes 
to that file?

I've tried running the text factory using  'all file types' as well as 
'text files only' but it still doesn't work.

Is anyone else having this problem or know how to solve it?

Many thanks,

Heulwen

-- 
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.


Soft Wrap and search replace project file

2013-08-10 Thread Joshua Wilson
Hello,

I work with very large log files and I would like to work on their 
formatting a bit.  I open up the a folder and then there are several other 
folders inside of it.  So I drag the main folder to the BBEdit icon and 
open it up as a project.  The main files I'm interested in are xyz.log, 
then xyz.log.1, xyz.log.2 (and so on to 48), but there are a few other 
files that I have to look at as well all in various folders in the project.

I have the language set to automatically apply as XML to xyz.log.  I 
couldn't get it to apply to xyz.log.1 .2 etc with a wildcard, so I just had 
to add .log.1 .log.2 etc for the language preferences.  No big deal. 
 However, it only seems to Soft Wrap xyz.log and when I do a multi file 
search, if I hit something on xyz.log.1 it does not soft wrap; and my 
engineers decided that text that spans 1000 characters long before wrapping 
is somehow a good idea.

Beyond this, I'm trying to automate a search and replace for a simple 
string but I guess I can't get the escape characters correct.
I have to deal with a lot of tags like 
blahvalue/blahblah2value2/blah2blah3value3/blah3
I found that an amazing simple search and replace where I replace  with 
\r results in
blahvalue/blah
blah2value2/blah2
blah3value3/blah3

It's amazing, and with the amount of data I have to read, a replace like 
this (and a soft wrap) makes so much difference in the amount of time it 
takes to go through these files.

I just can't get these either automated or mapped to a button (like to 
execute an apple script) that applies to all files in a project.

If I can just figure out what's wrong with the preferences to allow the xml 
formatting with the softwrap to actually apply to all files in the project, 
that'd be awesome.  Otherwise, can I programmatically do this?

I found a softwap that seems to work in AppleScript

*{{{*

*tell* *application* BBEdit

* set* project *to* *project document* 1

* tell* project

*  if* *not* (soft wrap text) *then*

* set* soft wrap text *to* true

* set* soft wrap mode *to* window width

* set* show page guide *to* false

* else*

* set* soft wrap text *to* false

* end* *if*

* end* *tell*
*end* *tell* 
}}}

But this does not apply to all items in a project.  

So is there any way to either fix my preferences to do the softwrap for the 
project or create an applescript that will both soft wrap to the window 
width as well as search and replace  with \r automatically or where I 
can at least bind it to a key?

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: Soft Wrap and search replace project file

2013-08-10 Thread Oliver Taylor
On Aug 10, 2013, at 1:34 PM, Joshua Wilson joshmit...@gmail.com wrote:

 So is there any way to either fix my preferences to do the softwrap for the 
 project

I can think of a few things that might help:

  1. Set BBEdit's default to soft-wrap
  2. Set a hot key for your soft-wrap preference

But having a number after your log files' extension is problematic.

 create an applescript that will both soft wrap to the window width as well as 
 search and replace  with \r automatically or where I can at least bind it 
 to a key?

The following applescript will do both, you can assign it a hot-key. There's 
probably a way to replace in the frontmost project, but I'm not certain how to 
do that.

tell application BBEdit
tell window 1 to set soft wrap text to true
replace  using \\n searching in text of front window options 
{search mode:grep, starting at top:true, wrap around:false, backwards:false, 
case sensitive:false, match words:false, extend selection:false}
end tell

-- 
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: Applescripting Search/Replace Strings Question

2012-09-24 Thread Kendall Conrad
The script seemed to work for me. When I add the line display dialog SS  
 /   RS it shows the correct values for me.

-Kendall


On Sunday, September 23, 2012 9:53:57 PM UTC-4, Christopher Stone wrote:

 Hey Folks,

 This is simple:

 tell *application* BBEdit
 set {search string:SS, replacement string:RS} to (current search strings)
 end tell

 But I can't seem to access 'replace string script' or 'search string 
 script'.

 search string properties

 What am I missing?

 Thanks.

 --
 Best Regards,
 Chris



-- 
-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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





filters/groupings for search/replace

2012-07-26 Thread JT
Hey all, I really like BBedit's ability to save search/replace presets but 
am finding that my selection is getting a bit big.

Would it be possible to have search groups/filter. That way when I am 
working on a particular project only certain saved search/replace saves are 
found?

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-23 Thread Christopher Stone
On Aug 22, 2011, at 17:20, verdonv wrote:
 After looking through the BBEdit script library, I realize the problem is 
 that the 'replace' actually returns an integer that represents the number of 
 instances of the pattern changed, and not the changed string.

Right.  I explained that already.  Perhaps my explanation wasn't clear?

 I know it seems silly, but given this, and the way that Clippings work, I 
 think I'll have to fudge this so that the applescript does the replace on the 
 selection, then copies the modified selection and returns it to the clipping, 
 so the clipping can insert it... 

I also explained that the major problem remaining is that clippings EAT 
trailing whitespace even if they themselves CONTAIN whitespace.  That takes a 
little working around; the script appended does so.

 Anyways, this is an applescript question and not a BBEdit question, so I'll 
 take the discussion to a more appropriate forum.

Any questions about scripting BBEdit are appropriate to this forum.

--
Best Regards,
Chris


tell application BBEdit
  try
tell front text window
  tell text of selection
replace (\\w+) using ¬
  [\\1] options {search mode:grep, case sensitive:false}
set selText to its contents
set chrOfst to its characterOffset
set selLen to its length
set selLen2 to selLen
  end tell
  repeat while selText ends with return
set selText to text 1 thru -2 of selText
set selLen to selLen - 1
  end repeat
  if selLen2 ≠ selLen then
select (characters chrOfst thru (chrOfst + selLen - 1))
  end if
  set sel to contents of text of selection
  return sel
end tell
  on error errMsg number errNum
set sep to ==
set e to sep  return  Error:   errMsg  return  sep  return ¬
   Error Number:   errNum  return  sep
beep
display dialog e
  end try
end tell


-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-23 Thread verdonv
 Right.  I explained that already.  Perhaps my explanation wasn't clear?
No it was fine. It just took a bit to sink in ;-)

 I also explained that the major problem remaining is that clippings EAT 
 trailing whitespace even if they themselves CONTAIN whitespace.  That takes a 
 little working around; the script appended does so.
I ran into something that must have been that in one of my attempts.

I REALLY appreciate your appended script. I'm reading through it now
to see if I can sort out what it's doing. The language constructs are
foreign to me, but I should be able to puzzle through the logic.

Thanks again,
v

On Aug 23, 9:34 am, Christopher Stone listmeis...@thestoneforge.com
wrote:
 On Aug 22, 2011, at 17:20, verdonv wrote:

  After looking through the BBEdit script library, I realize the problem is 
  that the 'replace' actually returns an integer that represents the number 
  of instances of the pattern changed, and not the changed string.

 Right.  I explained that already.  Perhaps my explanation wasn't clear?

  I know it seems silly, but given this, and the way that Clippings work, I 
  think I'll have to fudge this so that the applescript does the replace on 
  the selection, then copies the modified selection and returns it to the 
  clipping, so the clipping can insert it...

 I also explained that the major problem remaining is that clippings EAT 
 trailing whitespace even if they themselves CONTAIN whitespace.  That takes a 
 little working around; the script appended does so.

  Anyways, this is an applescript question and not a BBEdit question, so I'll 
  take the discussion to a more appropriate forum.

 Any questions about scripting BBEdit are appropriate to this forum.

 --
 Best Regards,
 Chris

 
 tell application BBEdit
   try
     tell front text window
       tell text of selection
         replace (\\w+) using ¬
           [\\1] options {search mode:grep, case sensitive:false}
         set selText to its contents
         set chrOfst to its characterOffset
         set selLen to its length
         set selLen2 to selLen
       end tell
       repeat while selText ends with return
         set selText to text 1 thru -2 of selText
         set selLen to selLen - 1
       end repeat
       if selLen2 ≠ selLen then
         select (characters chrOfst thru (chrOfst + selLen - 1))
       end if
       set sel to contents of text of selection
       return sel
     end tell
   on error errMsg number errNum
     set sep to ==
     set e to sep  return  Error:   errMsg  return  sep  return ¬
        Error Number:   errNum  return  sep
     beep
     display dialog e
   end try
 end tell
 

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-23 Thread John Delacour

At 13:54 -0700 20/08/2011, verdonv wrote:



Hi Chris,

Thanks for the feedback and the example. I like the simpler pattern
too :-)

As to why I am activating it from a clipping, well because it is part
of a bigger set of clippings.


So far as I can see you can use shell scripts in clippings just as 
well, and to do this:



My string might look like this...
C EM   Am7F

The result looks like this...
[C] [EM]   [Am7][F]



All you need is:

#! /usr/bin/perl
while () {s~(\w+)~[$1]~g; print}

JD

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-23 Thread John Delacour

At 09:03 -0400 20/08/2011, Verdon Vaillancourt wrote:

I am writing a tiny applescript, that I invoke with a clipping, to 
do a search/replace on a string and return the string. I'm mostly 
there.


My string might look like this...
C EM   Am7F

The result looks like this...
[C] [EM]   [Am7][F]



With your string selected, insert this clipping:

#script /posix/path/to/a.scpt#


which calls the AppleScript script:

-- a.scpt
tell application BBEdit to set _sele to get selection
do shell script perl -e '$_ = qq~  _sele  ~;
s~(\\w+)~[$1]~g;  print;'

This will work on multiple line selections as well.

JD

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-22 Thread verdonv
After looking through the BBEdit script library, I realize the problem
is that the 'replace' actually returns an integer that represents the
number of instances of the pattern changed, and not the changed
string. I know it seems silly, but given this, and the way that
Clippings work, I think I'll have to fudge this so that the
applescript does the replace on the selection, then copies the
modified selection and returns it to the clipping, so the clipping can
insert it... seems kind of round-about, but I really want to keep all
this within the clipping set.

Anyways, this is an applescript question and not a BBEdit question, so
I'll take the discussion to a more appropriate forum.

tty,
v

On Aug 20, 7:27 pm, verdonv verd...@verdon.ca wrote:
 Yes, that's the sort of direction I was trying to go with the 'as
 alias' thing... My thoughts, a) create a string from the contents of
 the selection, b) run the replace on the string, c) return the string,
 which the clipping will replace the original selection with... I just
 don't know much about applescript ;-)

 My original attempt works, but also produces the error/alert.

 v

 On Aug 20, 6:33 pm, Christopher Stone listmeis...@thestoneforge.com
 wrote:







  On Aug 20, 2011, at 15:54, verdonv wrote: Thanks for the feedback and the 
  example. I like the simpler pattern too :-)

  __

  Hey Verdon,

  You bet.

   As to why I am activating it from a clipping, well because it is part of 
   a bigger set of clippings. Clippings are the sensible method for most of 
   the set. This one is the oddball, but I want to keep everything together 
   in one toolbox, so to speak.

  If I understand the clipping/script mechanism correctly the script must 
  return a text value, which the clipping will emplace.

  The trouble is that your script acts on the selection, and then the 
  clipping wants to change the selection again to the output of the script.

  I was going to say that you could go ahead and get the selection after the 
  replace and return it, but there's some funky issue with whitespace getting 
  eaten.

  --
  Best Regards,
  Chris

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Scripting search/replace

2011-08-20 Thread Verdon Vaillancourt
Hi,

I am writing a tiny applescript, that I invoke with a clipping, to do a 
search/replace on a string and return the string. I'm mostly there.

My string might look like this...
C EM   Am7F

The result looks like this...
[C] [EM]   [Am7][F]

My script looks like this...
tell application BBEdit
activate
set chords to selection of text window 1
replace ([A-Za-z]+[0-9]|[A-Za-z]+)( *) using [\\1]\\2 searching in 
chords options {search mode:grep}
return chords
end tell

My Script does work, but it also returns an error...
Could not make some data into the desired type (MacOS Error code: -1700)

I've done some googling and believe I need to use 'as alias' somehow when I'm 
declaring the var chords. I have tried...
set chords as alias to selection of text window 1

.. but that didn't do it.

Any suggestions?
v

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-20 Thread Christopher Stone
On Aug 20, 2011, at 08:03, Verdon Vaillancourt wrote:
 I am writing a tiny applescript, that I invoke with a clipping, to do a 
 search/replace on a string and return the string. I'm mostly there.

__

Hey Verdon,

Any special reason you're activating this with a clipping rather simply putting 
your script in the script menu?

When you 'return chords' you're getting back something similar to:

 characters 2 thru 42 of text document 1 of application BBEdit

BBEdit then want to use this to replace the text you've already replaced with 
the script, but the data types don't match up.

Why not just use a script in the first place?

tell application BBEdit
  tell selection of front text window
replace (\\w+) using ¬
  [\\1] options {search mode:grep, case sensitive:false}
  end tell
end tell

--
Best Regards,
Chris

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-20 Thread verdonv
Hi Chris,

Thanks for the feedback and the example. I like the simpler pattern
too :-)

As to why I am activating it from a clipping, well because it is part
of a bigger set of clippings. Clippings are the sensible method for
most of the set. This one is the oddball, but I want to keep
everything together in one toolbox, so to speak.

best rgds,
verdon


On Aug 20, 2:16 pm, Christopher Stone listmeis...@thestoneforge.com
wrote:
 On Aug 20, 2011, at 08:03, Verdon Vaillancourt wrote:

  I am writing a tiny applescript, that I invoke with a clipping, to do a 
  search/replace on a string and return the string. I'm mostly there.

 __

 Hey Verdon,

 Any special reason you're activating this with a clipping rather simply 
 putting your script in the script menu?

 When you 'return chords' you're getting back something similar to:

  characters 2 thru 42 of text document 1 of application BBEdit

 BBEdit then want to use this to replace the text you've already replaced with 
 the script, but the data types don't match up.

 Why not just use a script in the first place?

 tell application BBEdit
   tell selection of front text window
     replace (\\w+) using ¬
       [\\1] options {search mode:grep, case sensitive:false}
   end tell
 end tell

 --
 Best Regards,
 Chris

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-20 Thread Christopher Stone
On Aug 20, 2011, at 15:54, verdonv wrote:
 Thanks for the feedback and the example. I like the simpler pattern too :-)
__

Hey Verdon,

You bet.

 As to why I am activating it from a clipping, well because it is part of a 
 bigger set of clippings. Clippings are the sensible method for most of the 
 set. This one is the oddball, but I want to keep everything together in one 
 toolbox, so to speak.


If I understand the clipping/script mechanism correctly the script must return 
a text value, which the clipping will emplace.

The trouble is that your script acts on the selection, and then the clipping 
wants to change the selection again to the output of the script.

I was going to say that you could go ahead and get the selection after the 
replace and return it, but there's some funky issue with whitespace getting 
eaten.

--
Best Regards,
Chris

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Scripting search/replace

2011-08-20 Thread verdonv
Yes, that's the sort of direction I was trying to go with the 'as
alias' thing... My thoughts, a) create a string from the contents of
the selection, b) run the replace on the string, c) return the string,
which the clipping will replace the original selection with... I just
don't know much about applescript ;-)

My original attempt works, but also produces the error/alert.

v


On Aug 20, 6:33 pm, Christopher Stone listmeis...@thestoneforge.com
wrote:
 On Aug 20, 2011, at 15:54, verdonv wrote: Thanks for the feedback and the 
 example. I like the simpler pattern too :-)

 __

 Hey Verdon,

 You bet.

  As to why I am activating it from a clipping, well because it is part of a 
  bigger set of clippings. Clippings are the sensible method for most of the 
  set. This one is the oddball, but I want to keep everything together in one 
  toolbox, so to speak.

 If I understand the clipping/script mechanism correctly the script must 
 return a text value, which the clipping will emplace.

 The trouble is that your script acts on the selection, and then the clipping 
 wants to change the selection again to the output of the script.

 I was going to say that you could go ahead and get the selection after the 
 replace and return it, but there's some funky issue with whitespace getting 
 eaten.

 --
 Best Regards,
 Chris

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Sitewide search/replace to change root-relative links to document-relative links

2011-06-29 Thread Rick
Each of the use statements means that a module is required. Some may
already be installed with your system, but for the others you need to
install a cpan client. I recommend
cpanminushttp://search.cpan.org/%7Emiyagawa/App-cpanminus-1.4008/lib/App/cpanminus.pm.
That requires a command-line installation, but it is only one command:

curl -L http://cpanmin.us | perl - --sudo App::cpanminus

Then proceed to installing the required perl modules (also a terminal
command):

$ cpanm GetOpt::Declare
$ cpanm  HTML::TreeBuilder

etc

Setting up a perl environment maybe an hour, but then you'll have access to
literally thousands of useful scripts and modules.


Rick Bychowski

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Sitewide search/replace to change root-relative links to document-relative links

2011-06-26 Thread BBunny
Thanks, Rick. I wish it were 'nuff said. After investigating how to
run a perl script, I ran it from the terminal. It responded (and I
quote):

Can't locate Getopt/Declare.pm in @INC (@INC contains: /Library/Perl/
Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /
System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-
multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-
thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/
Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /
System/Library/Perl/Extras/5.10.0 .) at /Users/BBunny/Library/
Application Support/BBEdit/Scripts/
change_absolute_to_relative_links.pl line 4.
BEGIN failed--compilation aborted at /Users/BBunny/Library/Application
Support/BBEdit/Scripts/change_absolute_to_relative_links.pl line 4.

Any clues what the problem might be? Also, it supposedly will change
absolute links (http://) to relative ones, but it says nothing about
changing root-relative links to document-relative ones, which is what
I'm trying to do.

On Jun 24, 9:10 pm, Rick wrink...@gmail.com wrote:
 http://www.perlmonks.org/?node=Change%20Absolute%20to%20Relative%20li...

 'nuff sed,
 Rick Bychowski

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Sitewide search/replace to change root-relative links to document-relative links

2011-06-26 Thread BBunny
What I need is a script that will do the following:

1. Note the location of file 'A' relative to the site root.

2. Find in  file 'A' the first root-relative or absolute link to
another file (file 'B') on the site.  (Root-relative: /
my_root_directory/path/file; Absolute: http://my_root_directory/path/file).

3. Based on the previously noted location of file 'A' relative to the
site root, and the path in the link, which specifies the path from the
site root to file 'B', calculate the direct path from file 'A' to file
'B'.

4. Change the link to the direct path.

5. Do this for every link in the file.

4. Do this for all files in this directory, recursively.

It seems as if these actions wouldn't be difficult if I knew
scripting...but I don't. Anyone want to give it a try and make me
ecstatic?

On Jun 24, 9:10 pm, Rick wrink...@gmail.com wrote:
 http://www.perlmonks.org/?node=Change%20Absolute%20to%20Relative%20li...

 'nuff sed,
 Rick Bychowski

On Jun 26, 12:27 pm, BBunny fran...@cherman.com wrote:
 Thanks, Rick. I wish it were 'nuff said. After investigating how to
 run a perl script, I ran it from the terminal. It responded (and I
 quote):

 Can't locate Getopt/Declare.pm in @INC (@INC contains: /Library/Perl/
 Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /
 System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-
 multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-
 thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/
 Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /
 System/Library/Perl/Extras/5.10.0 .) at /Users/BBunny/Library/
 Application Support/BBEdit/Scripts/
 change_absolute_to_relative_links.pl line 4.
 BEGIN failed--compilation aborted at /Users/BBunny/Library/Application
 Support/BBEdit/Scripts/change_absolute_to_relative_links.pl line 4.

 Any clues what the problem might be? Also, it supposedly will change
 absolute links (http://) to relative ones, but it says nothing about
 changing root-relative links to document-relative ones, which is what
 I'm trying to do.

 On Jun 24, 9:10 pm, Rick wrink...@gmail.com wrote:







 http://www.perlmonks.org/?node=Change%20Absolute%20to%20Relative%20li...

  'nuff sed,
  Rick Bychowski

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Sitewide search/replace to change root-relative links to document-relative links

2011-06-17 Thread BBunny
Simdude, thanks for replying. I don't understand how this would work.
I'm not just doing a simple sitewide find/replace. I'm trying to
replace root-relative paths with document-relative paths. That means
the script has to take into account the relative position of the
document being targeted to the document being edited. I don't see how
this script would do that. Am I missing something? (Also, forgive me,
but what does sed mean?)

On Jun 16, 12:51 pm, Simdude markmille...@gmail.com wrote:
 A shell script might work for you with a little sed. Here's a quick
 hack I use. I would test on some sample areas before doing anything
 important though. Assume you have a bunch of html files and want to
 change the word old to new. You would do this:

 sar old new *.html

 the quotes are needed. Here's the script:

  begin cut -

 #!/bin/ksh
 #--
 # File Name:   sar
 # Description: This file allows the user to search and replace a
 string
 #              in a bunch of files.
 #
 #              when using wildcards for the filename, place in quotes
 #
 #                     example: sar old new *.c
 #
 #--

 search=$1
 replace=$2
 files=$3

 for file in $files
 do
         cp $file $file.bak
         sed s/$search/$replace/g $file  tempsar
         mv tempsar $file
 done

  end cut -

 The script backs the file up first. You would save this to a text
 file, sar and make it executable (chmod +x sar).  This is obviously
 EXTREMELY simple with no error checking but I thought I would throw it
 out here as a starting point as there were no replies yet.

 Mark

 On Jun 16, 2:05 pm, BBunny fran...@cherman.com wrote:







  Still hoping for a response...

  On May 29, 12:06 am, BBunny fran...@cherman.com wrote:

   Can anyone suggest a grep search/replace or other technique for changing
   root-relative links of a Web site to document-relative? The site is
   site-root is identified in BBEdit's preferences as a Web site. There's a
   utility written to do this for a very early version of Dreamweaver (it 
   will
   also change all document-relative links to root-relative, if that's 
   desired,
   which it isn't), and it works, but only on the open document. The sitewide
   feature doesn't work. My site has nearly 3,000 html files, so opening each
   document and running the script would be extremely time-consuming, and the
   author is not going to update the script. I do not know javascript and I'm
   not that savvy with regular expressions either, so I would appreciate any
   suggestions for running a script like this sitewide in BBEdit.

   Thanks.

   For reference, the Dreamweaver utility is supposed to use this regex to
   select the files sitewide:

   .+\.html?$

   And it uses this script (which works, but only in the open document):

   /***/

   /* Change links to document/root relative. */

   /* Version 1.5.1 (28 Dec 2005) */

   /* Jason Dalgarno ja...@e7x.com */

   /***/

   /*

   * Copyright (C) 2005 Jason Dalgarno ja...@e7x.com

   *

   * This library is free software; you can redistribute it and/or modify it
   under

   * the terms of the GNU Lesser General Public License as published by the
   Free

   * Software Foundation; either version 2.1 of the License, or (at your
   option)

   * any later version.

   *

   * This library is distributed in the hope that it will be useful, but
   WITHOUT

   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS

   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
   more

   * details.http://www.gnu.org/licenses/lgpl.txt

   */

   function canAcceptCommand()

   {

   var sr, doc;

   sr = dreamweaver.getSiteRoot();

   doc = dreamweaver.getDocumentDOM('document');

   /*

   * If a site is defined, the document has been saved, the document is saved

   * in a defined site and the document is HTML.

   */

   return (sr  doc  doc.URL  doc.URL.indexOf(sr) == 0  
   fileIsHTML(doc)
!hasBaseHref(doc)) ? true : false;

   }

   function commandButtons()

   {

   return Array('Document relative', 'initRelativity(document, 
   document)',

   'Root relative', 'initRelativity(document, root)',

   'Absolute (http://...)', 'initRelativity(document, absolute)',

   'Sitewide - Document relative', 'initRelativity(site, document)',

   'Sitewide - Root relative', 'initRelativity(site, root)',

   'Get latest version', 'fetchLatest()',

   'Cancel', 'window.close()',

   'Help', 'relativityHelp()');

   }

   function relativityHelp()

   {

   dreamweaver.browseDocument(dreamweaver.getConfigurationPath() +
   '/Shared/JSN/relativity/help.htm');

   }

   /**

   * Check if the current document/file is a HTML document

Re: Sitewide search/replace to change root-relative links to document-relative links

2011-06-16 Thread BBunny
Still hoping for a response...

On May 29, 12:06 am, BBunny fran...@cherman.com wrote:
 Can anyone suggest a grep search/replace or other technique for changing
 root-relative links of a Web site to document-relative? The site is
 site-root is identified in BBEdit's preferences as a Web site. There's a
 utility written to do this for a very early version of Dreamweaver (it will
 also change all document-relative links to root-relative, if that's desired,
 which it isn't), and it works, but only on the open document. The sitewide
 feature doesn't work. My site has nearly 3,000 html files, so opening each
 document and running the script would be extremely time-consuming, and the
 author is not going to update the script. I do not know javascript and I'm
 not that savvy with regular expressions either, so I would appreciate any
 suggestions for running a script like this sitewide in BBEdit.

 Thanks.

 For reference, the Dreamweaver utility is supposed to use this regex to
 select the files sitewide:

 .+\.html?$

 And it uses this script (which works, but only in the open document):

 /***/

 /* Change links to document/root relative. */

 /* Version 1.5.1 (28 Dec 2005) */

 /* Jason Dalgarno ja...@e7x.com */

 /***/

 /*

 * Copyright (C) 2005 Jason Dalgarno ja...@e7x.com

 *

 * This library is free software; you can redistribute it and/or modify it
 under

 * the terms of the GNU Lesser General Public License as published by the
 Free

 * Software Foundation; either version 2.1 of the License, or (at your
 option)

 * any later version.

 *

 * This library is distributed in the hope that it will be useful, but
 WITHOUT

 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS

 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
 more

 * details.http://www.gnu.org/licenses/lgpl.txt

 */

 function canAcceptCommand()

 {

 var sr, doc;

 sr = dreamweaver.getSiteRoot();

 doc = dreamweaver.getDocumentDOM('document');

 /*

 * If a site is defined, the document has been saved, the document is saved

 * in a defined site and the document is HTML.

 */

 return (sr  doc  doc.URL  doc.URL.indexOf(sr) == 0  fileIsHTML(doc)
  !hasBaseHref(doc)) ? true : false;

 }

 function commandButtons()

 {

 return Array('Document relative', 'initRelativity(document, document)',

 'Root relative', 'initRelativity(document, root)',

 'Absolute (http://...)', 'initRelativity(document, absolute)',

 'Sitewide - Document relative', 'initRelativity(site, document)',

 'Sitewide - Root relative', 'initRelativity(site, root)',

 'Get latest version', 'fetchLatest()',

 'Cancel', 'window.close()',

 'Help', 'relativityHelp()');

 }

 function relativityHelp()

 {

 dreamweaver.browseDocument(dreamweaver.getConfigurationPath() +
 '/Shared/JSN/relativity/help.htm');

 }

 /**

 * Check if the current document/file is a HTML document

 *

 * @param object Document

 * @return boolean True is file is an html document, false if not.

 */

 function fileIsHTML(doc)

 {

 /*

 * .search(/html/i) is to allow for HTML in uppercase.

 *

 * Relativity cannot work on a partial document that is included elsewhere

 * by SSI or PHP (for example) as it will not be able to resolve the base

 * URL correctly.

 */

 return doc.getParseMode() == 'html' 
 doc.documentElement.outerHTML.search(/html/i) != -1;

 }

 /**

 * If a file has a base href=... / do not modify links

 *

 * @param object Document

 * @return boolean True if file has base href, false if we can safely modify
 it

 */

 function hasBaseHref(doc)

 {

 var base, i, ret = false;

 base = doc.getElementsByTagName('BASE');

 for (i = 0; i  base.length; ++i) {

 if (base[i].href) {

 ret = true;

 break;

 }
 }

 return ret;

 }

 /**

 * Read updater file from remote server and check version numbers

 */

 function fetchLatest()

 {

 /*

 * remote file goes like this:

 * version=1.2.3

 * url=http://www.example.com/dwextension.mxp

 * filename=filename_for_local_file.ext

 * title=Text for download dialog title

 * beforemessage=Some message to show before downloading.

 * donemessage=Message to show after file has been downloaded.

 */

 var currentVersion, updaterUrl, versionFile, latest, pairs, i, params,
 confirmMsg, gotUpdate;

 currentVersion = '1.5.1';

 updaterUrl = 'http://www.microwaved.plus.com/dw/relativityupdate.txt';

 versionFile = MMHttp.getText(updaterUrl);

 if (versionFile.statusCode == 200) {

 latest = new Array;

 pairs = versionFile.data.replace(/\r\n?/, '\n').split('\n');

 for (i = 0; i  pairs.length; ++i) {

 params = pairs[i].split('=');

 if (params.length == 2) {

 latest[params[0]] = params[1].replace(/\s+$/, '');

 }
 }

 if (latest.version  latest.url  latest.filename  latest.title

  latest.beforemessage  latest.donemessage) {

 latest.beforemessage = latest.beforemessage.replace(/\\n/g, '\n');

 latest.donemessage

Re: Sitewide search/replace to change root-relative links to document-relative links

2011-06-16 Thread Simdude
A shell script might work for you with a little sed. Here's a quick
hack I use. I would test on some sample areas before doing anything
important though. Assume you have a bunch of html files and want to
change the word old to new. You would do this:

sar old new *.html

the quotes are needed. Here's the script:

 begin cut -

#!/bin/ksh
#--
# File Name:   sar
# Description: This file allows the user to search and replace a
string
#  in a bunch of files.
#
#  when using wildcards for the filename, place in quotes
#
# example: sar old new *.c
#
#--

search=$1
replace=$2
files=$3

for file in $files
do
cp $file $file.bak
sed s/$search/$replace/g $file  tempsar
mv tempsar $file
done


 end cut -

The script backs the file up first. You would save this to a text
file, sar and make it executable (chmod +x sar).  This is obviously
EXTREMELY simple with no error checking but I thought I would throw it
out here as a starting point as there were no replies yet.

Mark

On Jun 16, 2:05 pm, BBunny fran...@cherman.com wrote:
 Still hoping for a response...

 On May 29, 12:06 am, BBunny fran...@cherman.com wrote:

  Can anyone suggest a grep search/replace or other technique for changing
  root-relative links of a Web site to document-relative? The site is
  site-root is identified in BBEdit's preferences as a Web site. There's a
  utility written to do this for a very early version of Dreamweaver (it will
  also change all document-relative links to root-relative, if that's desired,
  which it isn't), and it works, but only on the open document. The sitewide
  feature doesn't work. My site has nearly 3,000 html files, so opening each
  document and running the script would be extremely time-consuming, and the
  author is not going to update the script. I do not know javascript and I'm
  not that savvy with regular expressions either, so I would appreciate any
  suggestions for running a script like this sitewide in BBEdit.

  Thanks.

  For reference, the Dreamweaver utility is supposed to use this regex to
  select the files sitewide:

  .+\.html?$

  And it uses this script (which works, but only in the open document):

  /***/

  /* Change links to document/root relative. */

  /* Version 1.5.1 (28 Dec 2005) */

  /* Jason Dalgarno ja...@e7x.com */

  /***/

  /*

  * Copyright (C) 2005 Jason Dalgarno ja...@e7x.com

  *

  * This library is free software; you can redistribute it and/or modify it
  under

  * the terms of the GNU Lesser General Public License as published by the
  Free

  * Software Foundation; either version 2.1 of the License, or (at your
  option)

  * any later version.

  *

  * This library is distributed in the hope that it will be useful, but
  WITHOUT

  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS

  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  more

  * details.http://www.gnu.org/licenses/lgpl.txt

  */

  function canAcceptCommand()

  {

  var sr, doc;

  sr = dreamweaver.getSiteRoot();

  doc = dreamweaver.getDocumentDOM('document');

  /*

  * If a site is defined, the document has been saved, the document is saved

  * in a defined site and the document is HTML.

  */

  return (sr  doc  doc.URL  doc.URL.indexOf(sr) == 0  fileIsHTML(doc)
   !hasBaseHref(doc)) ? true : false;

  }

  function commandButtons()

  {

  return Array('Document relative', 'initRelativity(document, document)',

  'Root relative', 'initRelativity(document, root)',

  'Absolute (http://...)', 'initRelativity(document, absolute)',

  'Sitewide - Document relative', 'initRelativity(site, document)',

  'Sitewide - Root relative', 'initRelativity(site, root)',

  'Get latest version', 'fetchLatest()',

  'Cancel', 'window.close()',

  'Help', 'relativityHelp()');

  }

  function relativityHelp()

  {

  dreamweaver.browseDocument(dreamweaver.getConfigurationPath() +
  '/Shared/JSN/relativity/help.htm');

  }

  /**

  * Check if the current document/file is a HTML document

  *

  * @param object Document

  * @return boolean True is file is an html document, false if not.

  */

  function fileIsHTML(doc)

  {

  /*

  * .search(/html/i) is to allow for HTML in uppercase.

  *

  * Relativity cannot work on a partial document that is included elsewhere

  * by SSI or PHP (for example) as it will not be able to resolve the base

  * URL correctly.

  */

  return doc.getParseMode() == 'html' 
  doc.documentElement.outerHTML.search(/html/i) != -1;

  }

  /**

  * If a file has a base href=... / do not modify links

  *

  * @param object Document

  * @return boolean True if file has

Search Replace

2011-05-29 Thread jj200...@gmail.com
Hi all I would like to find lines like below and replace them with
blank lines, I have read the GREP tutorial but had no succes PLEASE
help

p class=text08-06-2011 15:49:25/p
p class=text08-06-2011 15:54:45/p
p class=text08-06-2011 15:56:13/p

Also is it possible to script so I can replace different lines in the
same workflow??

Regards

John

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Search Replace

2011-05-29 Thread Doug McNutt
At 07:23 -0700 5/29/11, jj200...@gmail.com wrote:
Hi all I would like to find lines like below and replace them with
blank lines, I have read the GREP tutorial but had no succes PLEASE
help

p class=text08-06-2011 15:49:25/p
p class=text08-06-2011 15:54:45/p
p class=text08-06-2011 15:56:13/p

Also is it possible to script so I can replace different lines in the
same workflow??


It sorta depends on what else is in your file.  With grep turned on the idea is 
that .*, without quotes will match anything.  .+ will match one or more of 
anything.

p class=text08-06-2011 .+/p

would be a search string that would look for an identical date but would allow 
anything for the time part.

p class=text08-06-2011 [\d:]+/p

Would match times that have digits, \d, and colons in them.

How fancy you need to be is determined by the lines you want to keep. Doing a 
search and find next a few times before you replace all is a good way to check 
for accidental finds of something you want..

To replace just the text leaving a blank line your replacement string would be 
 - an empty string. If you want the whole line to go you could add \r to the 
end of the search string so you would be replacing the line end with nothing.

Note that you usually have to escape things in your search string that are 
special symbols used by grep.  That would include a period . but you don't 
seem to have anything like that in the line as you present it.

As for different lines, that would be a script or a text factory. Personally I 
find plain old perl scripts are easier but that's just me.
-- 

-- A fair tax is one that you pay but I don't --

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Re: Search Replace

2011-05-29 Thread Christopher Stone
On May 29, 2011, at 09:23, jj200...@gmail.com wrote:
 Hi all I would like to find lines like below and replace them with blank lines
 
 p class=text08-06-2011 15:49:25/p
 p class=text08-06-2011 15:54:45/p
 p class=text08-06-2011 15:56:13/p
 
 Also is it possible to script so I can replace different lines in the same 
 workflow??
__

Hey John,

This one is easy, although GREP usually looks very alien to those unfamiliar 
with it.

Pattern 1 take into account the possibility of single digits in both the date 
and the time, while Pattern 2 assumes a fixed-length date and time.

Pattern 1: p class=text\d{1,2}-\d{1,2}-\d{4} \d{1,2}:\d{1,2}:\d{1,2}/p
Pattern 2: p class=\text\\d{2}-\d{2}-\d{4} \d{2}:\d{2}:\d{2}/p

\d  == a digit
[0-9]   == although not used here it is a more traditional digit means of 
representing a digit.
{1,2}   == quantifiers: in this case one OR two

Notice that in the script you need to double-up on escape characters - '\' 
becomes '\\'.


set grepPattern1 to p class=\text\\\d{1,2}-\\d{1,2}-\\d{4} 
\\d{1,2}:\\d{1,2}:\\d{1,2}/p
set grepPattern2 to p class=\text\\\d{2}-\\d{2}-\\d{4} 
\\d{2}:\\d{2}:\\d{2}/p

tell application BBEdit
  try
tell text of front text window
  replace grepPattern2 using  options {starting at top:true, search 
mode:grep, case sensitive:false}
  # More replace statements here #

end tell
  on error errMsg number errNum
set sep to ==
set e to sep  return  Error:   errMsg  return  sep  return ¬
   Error Number:   errNum  return  sep
beep
display dialog e
  end try
end tell


You can create multiple replace statements and go to town.

--
Best Regards,
Chris

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
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


Save a series of GREP search/replace as macro?

2010-06-17 Thread Bill Mounce
I am trying to find a way to run a series of GREP search and replace
routines. Is this what Scripts are for? If so, is there  a sample of a
simple GREP search and replace that I can learn from? (I am not asking
about how to do GREP, but to save the GREP search/replaces inside
BBEdit.)

For example, I want to find ^(.+?)\t.+?\r and replace it with
\1\r. How would I do save that in a script?

The issue is that I have hundreds of pages of text to manipulate, but
because each one may be a little different I don't want to batch a
GREP change on all of them, but basically I need to run the same set
of search and replaces on all of them one by one.

Thanks for your help.

Bill

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Save a series of GREP search/replace as macro?

2010-06-17 Thread gabe . roth
 I am trying to find a way to run a series of GREP search and replace
 routines. Is this what Scripts are for?

Text Factories might be what you're looking for. See p. 127 in the manual.

gr.






If so, is there  a sample of a
 simple GREP search and replace that I can learn from? (I am not asking
 about how to do GREP, but to save the GREP search/replaces inside
 BBEdit.)

 For example, I want to find ^(.+?)\t.+?\r and replace it with
 \1\r. How would I do save that in a script?

 The issue is that I have hundreds of pages of text to manipulate, but
 because each one may be a little different I don't want to batch a
 GREP change on all of them, but basically I need to run the same set
 of search and replaces on all of them one by one.

 Thanks for your help.

 Bill

 --
 You received this message because you are subscribed to the
 BBEdit Talk discussion group on Google Groups.
 To post to this group, send email to bbedit@googlegroups.com
 To unsubscribe from this group, send email to
 bbedit+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/bbedit?hl=en
 If you have a feature request or would like to report a problem,
 please email supp...@barebones.com rather than posting to the group.

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Save a series of GREP search/replace as macro?

2010-06-17 Thread Rich Siegel

On Thursday, June 17, 2010, Bill Mounce billmou...@gmail.com wrote:


I am trying to find a way to run a series of GREP search and replace
routines.


From your description, I think a Text Factory would do what you 
need. Chapter 5 (Text Transformations) in the user manual 
contains a section about how to create and apply them. (See the 
Help menu for the user manual.)


Enjoy,

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.


--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Save a series of GREP search/replace as macro?

2010-06-17 Thread Bill Mounce
Thanks so much. I had wondered what TextFactory was.

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Save a series of GREP search/replace as macro?

2010-06-17 Thread Bill Mounce
Thanks so much.

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Is there a way to avoid folding expansion when search/replace selected text only?

2010-05-06 Thread Michael Wiik
I note that when doing a search/replace across a file or even just 'selected
text only' that all folds are expanded. This makes it tedious as I need to
re-fold everything to select the text for the next search/replace (think
several thousand lines of html in nearly-identical groupings). Is there a
preference or way to prevent this fold expansion?

Thanks,
-Mike

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Re: TextFactory Search/Replace 1st match only

2010-03-09 Thread Matt Martini

Well, I'm not sure how to do this in a textfactory, but it is trivial in perl.

Below is a sample perl program that does what you want.  To make this production
just change DATA to  on the while line and use it as a unix filter. 
(you also don't need 
anything below # desired output)

Good Luck,

Matt


#!/usr/bin/perl

printf( %5s %5s %5s\n, 'data1', 'data2', 'data3' );

while ( $line = DATA ) {
chomp($line);

if ( $line =~ m|^data1=(.*?);\s+data2=(.*?);\s+data3=(.*?);| ) {
printf( %5s %5s %5s\n, $1, $2, $3 );
}

}

# desired output
# data1 data2 data3
# 234.4 343.7 588.0
# 511.5 654.7 654.9
# 651.8 925.5 876.0

__END__
random
junk
in 
file
data1=234.4; data2=343.7; data3=588.0;
data1=511.5; data2=654.7; data3=654.9;
data1=651.8; data2=925.1; data3=876.0;



On Mar 3, 2010, at 12:20 AM, yogert909 wrote:

 Hi, I am writing a textfactory which uses part of a line as a column
 header. I want to duplicate the first line of data and create the
 headers from that. Is there a way to tell BBedit to find/replace only
 the 1st match and not all matches? Here is the format:
 
 
 There are several lines of random
 text here then comes the data below.
 
 data1=234.4; data2=343.7; data3=588.0;
 data1=511.5; data2=654.7; data3=654.9;
 data1=651.8; data2=925.1; data3=876.0;
 
 format like this:
 
 data1 data2 data3
 234.4 343.7 588.0
 511.5 654.7 654.9
 651.8 925.5 876.0
 Edit/Delete Message
 

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

TextFactory Search/Replace 1st match only

2010-03-03 Thread yogert909
 Hi, I am writing a textfactory which uses part of a line as a column
header. I want to duplicate the first line of data and create the
headers from that. Is there a way to tell BBedit to find/replace only
the 1st match and not all matches? Here is the format:


There are several lines of random
text here then comes the data below.

data1=234.4; data2=343.7; data3=588.0;
data1=511.5; data2=654.7; data3=654.9;
data1=651.8; data2=925.1; data3=876.0;

format like this:

data1 data2 data3
234.4 343.7 588.0
511.5 654.7 654.9
651.8 925.5 876.0
Edit/Delete Message

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: The modeless search/replace dialog also has a problem

2009-03-25 Thread rowen

I have noticed this as well. It is very frustrating. I can't figure
out how BBEdit decides which searches to save and which to not save in
its history, but I wish the logic was either updated (to save the most
recent version always) or offered more manual control (so I could save
an expression I plan to use a lot and ditch any invalid ones).

-- Russell

On Mar 20, 11:21 pm, Bill Hernandez m...@mac-specialist.com wrote:
 The modeless search/replace dialog also has a problem.

 Let's say that I search for :

 Grep : \$this-form-\$form_common_output
 Replace : \$this-form-\$form_common_output

 and I do the search, I then realize there was a mistake in the replace  
 part, it should have been :

 Replace : \$this-form-form_common_output

 and you do the search.

 Life is swell...

 You now do another search, and later on you come back and want to  
 recall the search above from the button/popup.

 When you select it the replace value will contain the original string  
 that was incorrect, and nothing I can do will allo me to save the  
 correct replace.

 It appears that once the record is created for a specific 'Grep :',  
 the replace cannot be modified/saved. It always keeps coming back with  
 the original value saved.

 Bill Hernandez
 Plano, Texas
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to supp...@barebones.com 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: The modeless search/replace dialog also has a problem

2009-03-25 Thread Rod Buchanan

On Mar 25, 2009, at 1:04 PM, rowen wrote:

 I have noticed this as well. It is very frustrating. I can't figure
 out how BBEdit decides which searches to save and which to not save in
 its history, but I wish the logic was either updated (to save the most
 recent version always) or offered more manual control (so I could save
 an expression I plan to use a lot and ditch any invalid ones).

I _think_ the way it works is that if you use the dialog buttons it  
will save the replace string.  If you use the keyboard (Enter / Cmd- 
T / etc.) it doesn't.  I almost always use the keyboard and it almost  
always never remembers replace strings. :)  It would be nice if it  
worked the same both ways.

I CC'd support in case I'm right right to consider this a bug report  
and/or feature request.

 On Mar 20, 11:21 pm, Bill Hernandez m...@mac-specialist.com wrote:

 The modeless search/replace dialog also has a problem.

 Let's say that I search for :

 Grep : \$this-form-\$form_common_output
 Replace : \$this-form-\$form_common_output

 and I do the search, I then realize there was a mistake in the  
 replace
 part, it should have been :

 Replace : \$this-form-form_common_output

 and you do the search.

 Life is swell...

 You now do another search, and later on you come back and want to
 recall the search above from the button/popup.

 When you select it the replace value will contain the original string
 that was incorrect, and nothing I can do will allo me to save the
 correct replace.

 It appears that once the record is created for a specific 'Grep :',
 the replace cannot be modified/saved. It always keeps coming back  
 with
 the original value saved.

 Bill Hernandez
 Plano, Texas

--
Rod Buchanan
Kelly Supply / KDSI / ISCO
308 382-8764 x220

Unix for stability;
Macs for productivity;
Windows for Solitaire


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to supp...@barebones.com 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: Beginner here - Search Replace help!

2008-09-30 Thread Dennis Cox

On 9/30/08 3:24 AM, Patrick James [EMAIL PROTECTED] wrote:

 
 The book mentioned in BBEdit Help:
 
 Mastering Regular Expressions, 2nd Edition
 by Jeffrey E.F. Friedl.
 is top class and very good to get if you want to explore RegEx any
 further.
 
 Patrick
 
 http://www.patrickjames.co.uk
 

Mr. Friedl's been busy:

The Third Edition
http://oreilly.com/catalog/9780596528126/index.html

Dennis Cox


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: Beginner here - Search Replace help!

2008-09-30 Thread Patrick James

Mr. Friedl has indeed been busy :)

The third edition is the one I have as well.

When I go to that web-page I see that there is a book called Regular  
Expression Pocket Reference by Tony Stubblebine which I think looks  
like a very useful book to have.

Patrick

http://www.patrickjames.co.uk

 Mr. Friedl's been busy:

 The Third Edition
 http://oreilly.com/catalog/9780596528126/index.html

 Dennis Cox

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: Beginner here - Search Replace help!

2008-09-29 Thread Ewelk

BTW, I'm using the BBEdit Help to understand the symbols and patterns
you used, but am having a little trouble.

What does the ? represent?  Is that a wildcard?  Is there a way to
limit the wildcard to numbers only?  I see something about a /d for
digits.  Also, the parenthical after the number doesn't seem to be
stripped out and I can't make that take either for some reason.

Any help would be great, but I'll keep slugging along as well.  Thanks
again!
Eric

On Sep 25, 2:50 pm, Patrick James [EMAIL PROTECTED] wrote:
 On 25 Sep 2008, at 20:10, Ewelk wrote:



  Hi there, I was hoping someone might help me out here.  I'm evaluating
  BBEdit to see if it will help with some of my work, which requires
  text formatting.  Basically, I receive a file with text in it that
  looks like this:

  Centralized Documents (331 20th Street) Files including A-Z

  And I need to format it so it looks like this:

  Centralized Documents
  331 20th Street ADDRESS

  Files including A-Z

 Hi

 I think that to change the first line into the following will work with:

 Find: (^.+?)(\()(.+?)(\) )(.+)

 Replace: \01\r\03 ADDRESS\r\r\05

 You need to check the Grep box of course in the Find/Replace  
 dialogue window.

  So what I was hoping to figure out is a way to wildcard the search 
  replace, so that when it encounters a (*) it strips the parentheticals
  and appends ADDRESS at the end.  Also, a way to include those line
  breaks.

 To do just bit you might try:

 Find: (\()(.+?)(\) )

 Replace: \2 ADDRESS\r\r

  I'm only using the demo version of BBEdit so not sure if the full has
  added functionality, but interested if I can make that work.

 My very basic stab at this may work for you or may need modification.

 The key thing though is that BBEdit can easily accomplish this kind of  
 thing. It is the king of Find/Replace :)

 If you go to the Help and check out Grep Reference, there you will be  
 able to read about how you can create the expressions to suit your  
 particular requirement.

 Best of luck

 Patrick

 http://www.patrickjames.co.uk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---