Marcus,

I think that you may not realize that the backslash codes used in replacement 
strings are not the same as the backslash codes used in search strings.

In a search string, there is a very rich collection of codes to describe the 
things to be matched. 
The result of the matching operation is simply an array of matched substrings 
corresponding to the parenthesized sub patterns in the search string.
The only backslash codes in a replacement string are a backslash followed by a 
digit, which means to insert the corresponding element of the matched substring 
array into the replacement string at this point (and “\\” which means insert a 
single backslash). All other backslashes are ignored.

In particular, “\d, means “match a digit” in a search string, but it means 
“ignore the backslash and insert the letter d” in a replacement string. 

Again, the way that you insert matched text from the search string is 

Use parentheses in the search string to delimit the portion of the matched 
string that you want to “capture,”
Use “backslash + digit” in the replacement string to identify which captured 
substring you want to insert in the result.

Regards,
Neil Faiman

> On May 9, 2024, at 5:43 PM, Marcus Abundis <55m...@gmail.com> wrote:
> 
> Hey Rich,
> 
> Thanks much for looking at this issue!
> Okay, I closely read the material in Chapter 8 and explored the Pattern 
> Playground, and I am pretty sure I understand what I read and saw.
> I also feel I have a grasp of HOW wildcard Find and Replace commands are 
> SUPPOSED to work.
> Using a Subpattern structure, as also suggested by Kaveh, such as " 
> (\d\d\.\d\d\.\d\d\d\d, \d\d:\d\d, )" does not seem to improve things.
> What I am trying to accomplish does not seem that complicated to me, so I am 
> really scratching my head here.
> This software should have fairly stable basic functions after 30 years, no?
> It looks to me like I may have encountered a straight-up BUG — in no case 
> should a "\d" used to find a NUMERIC value produce a "d" ALPHABETIC value 
> output.
> That's just basic mixing apples and oranges, no? I really don't know what is 
> going on here.
> Can you PLEASE tell me what EXACT string(s) you think I should be using here 
> to realize my desired output?
> I would like to confirm this is an actual bug (given I am a noob to BBEdit), 
> before I waste anyone's time with a bug report?
> For your information I am using BBEdit 15.0.3 on MacOS 11.7.10, but I first 
> encountered this problem on an earlier version of BBEdit and MacOS.
> 
> Thanks much for the help!
> 
> Marcus
> On Wednesday, May 8, 2024 at 2:18:36 PM UTC+2 Rich Siegel wrote:
>> On 8 May 2024, at 6:01, Marcus Abundis wrote: 
>> 
>> > Greetings, 
>> > 
>> > I am new to BBEdit (trying it out) and I have a problem in using the 
>> > standard “Find and Replace” window in BBEdit. Only the “Grep” and “Show 
>> > matches” boxes checked in that window (no other boxes checked), and the 
>> > situation unfolds as follows: 
>> > 
>> > TARGET STRING/FIELD: “ 29.12.2023, 10:23, ” 
>> > — Target values, held in varied records, with varied fields for each 
>> > record, all in one .CSV file. 
>> > 
>> > FIND STRING: “ \d\d\.\d\d\.\d\d\d\d, \d\d:\d\d, ” 
>> > — This Find String works exactly as I wish, no problems. 
>> > 
>> > REPLACE STRING: “;\d\d\.\d\d\.\d\d\d\d, \d\d:\d\d, ” 
>> > — This Replace String does NOT work as desired. I want to replace the 
>> > leading “ ” space with a “;” while RETAINING all original digital values. 
>> 
>> Chapter 8 of the user manual is an excellent reference to how Grep works (in 
>> BBEdit and in general), and in particular the section on "Writing 
>> Replacement Patterns" beginning on page 212 is relevant to your interests. 
>> 
>> To summarize: you need to specify in your original pattern which part(s) it 
>> you want to use in the replacement, by putting parentheses around them. In 
>> the replacement pattern, you can make reference to those subpatterns to 
>> construct the replacement text. 
>> 
>> The user manual is available via the Help menu. 
>> 
>> The Pattern Playground (on the Search menu) is handy for exploring match and 
>> replace behavior, as well. 
>> 
>> Enjoy, 
>> 
>> R. 
>> 
>> 
>> -- 
>> Rich Siegel Bare Bones Software, Inc. 
>> <sie...@barebones.com <>> <https://www.barebones.com/> 
>> 
>> Someday I'll look back on all this and laugh... until they sedate me. 
> 
> 
> -- 
> 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 <mailto:supp...@barebones.com>" rather than posting 
> here. Follow @bbedit on Mastodon: <https://mastodon.social/@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 
> <mailto:bbedit+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/005e25e9-132d-40ab-bae0-ee160c8cc4adn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/005e25e9-132d-40ab-bae0-ee160c8cc4adn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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: 
<https://mastodon.social/@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/31F99E1C-FB7A-424B-8084-E65902EA4C96%40faiman.org.

Reply via email to