Great explanation Bucky— I shouldn’t have been so lazy as to not give an 
explanation myself! Thanks for doing what I should have done. It’s perfect.

> On May 8, 2022, at 8:13 PM, Bucky Junior <[email protected]> wrote:
> 
> I was fortunate to learn some bits of regex/grep from helpful people on this 
> list who not only showed an answer to a question but explained what was 
> happening. While this search/replace using grep is quite simple, it’s not 
> always obvious to everyone.
> 
> 
>> On May 8, 2022, at 1:36 PM, Dave Simpson <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> You want to do a GREP search, with search string like this:
>> 
>> ^(2 PLAC)(.*)$
>> 
>> And you want to replace with this:
>> 
>> \1\2 England
>> 
>> That’s it. Try it.
>> 
> 
> In the search pattern:
> ^ means start at the beginning of a line
> (2 PLAC) parentheses bracket the search text and “remembers" it. In this 
> case, it is known characters. Grep lets you search for unknown/partially 
> known characters too.
> (.*) second parentheses uses “.” As any character except newline or carriage 
> return. The asterisk expands that to zero or more characters.
> $ means the end of the line.
> 
> The replacement is
> \1 first parentheses “remembered” pattern
> \2 follow that with the second
> England end the replacement with a space and then the literal text “England”
> 
> That’s mostly this grep/replace. You know the BBEdit Manual has lots more.
> Bucky

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A254A9AE-ADD7-4353-A268-18E709817BDF%40christianboyce.com.

Reply via email to