Jason, This is pretty much exactly what has been discussed in a very recent thread. There must be a discoverability issue in the manual... :)
What you need to do is have BBEdit *remember* the match so that it can keep it as is in the replace string. ^([[:upper:]]+)$ replaced by \1, UNKNOWN what you need to read is in "Creating Subpatterns", p 186 of the manual and the following section "Using Backreferences in Subpatterns". Et voilà ! Jean-Christophe > On Jan 13, 2020, at 22:51, Jason M. Kelly <[email protected]> wrote: > > I am beginning a new project and attempting to use BBEdit prepare a data set > for input into a database. For the first step, I would like to add a string > to each text entry in all caps that does not have a first name after it. For > example, using the sample from the data set below, I would like to transform > the entry “ABBOTT” into “ABBOTT, UNKNOWN” > > > ABBOTT, EDWARD (c.1737–91), painter, of Long Acre, London; according to > Redgrave, he travelled in France and Italy with the engraver William Wynne > Ryland, i.e. c.1760; see Ryland. > > ABBOTT, JOHN, merchant; see Francis Harriman > > ABBOTT > 1763 Naples (31 Dec.; Martin jnl.MSS) > > > I am able to search for each entry in all caps that is not followed by a > first name using this GREP formula: ^[[:upper:]]+$ > > For the life of me, I cannot figure out how to use the REPLACE function to > retain the original text and append a string. (e.g. to transform “ABBOTT” > into “ABBOTT, UNKNOWN”) > > I’m sure it’s a really simple thing that I’m missing, but I have been trouble > finding a solution online. > > I appreciate any help from this list. Thanks. > > -- > 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/35e76da1-8142-4168-af9e-abdf529b0602%40googlegroups.com. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune -- 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/6A472DE2-0203-46B6-BA07-1074E94F9C7D%40traduction-libre.org.
