Bruce, You have clearly caught my issues in misunderstanding and not knowing - about the ?: usage and capture variables. Thank you!!!
Keri - I appreciate your input on this as well! Thank you. Peter On Saturday, September 26, 2020 at 9:34:03 PM UTC-5 Bruce Van Allen wrote: > On 9/26/20 at 6:30 PM, [email protected] (Peter Kaufman) wrote: > > >I’m finding that only the LAST of the Access Codes is saved > >though. None of those before the last one. > > Even though your last capture is allowed to repeat because of > the (...)+, it only becomes one \# capture variable. > > The key thing is to repeat the "\t\t(.*)\n" but allow the repeat > to be optional, plus not incidentally capture the wrong stuff: > > (?:\t\t(.*?)\n)? > > This is the repeating optional match after the first match under > Access Code. What's the maximum number of Access Codes you'd > encounter? Make sure you have that many optional repeats of > that sub-pattern, and capture \# variables in the replacement pattern. > > The '?:' after the first opening parens of that sub-pattern > keeps it from being captured into a \# variable. > > Access Codes\n\t\t(.*?)\n(?:\t\t(.*?)\n)?(?:\t\t(.*?)\n)?(?:\t\t(.*?)\n)?\n > > Matches your first two records and > > REPLACE: \1\t\2\t\3\t\4\t\5\t\6\t\8\t\9\t\10\t\11\n > > Again, this could be simplified and made sturdier for heavy use, > and I didn't test it on your remaining sample records. > > HTH > -- > > - Bruce > > _bruce__van_allen__santa_cruz__ca_ > > -- 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/1dacd4d4-f181-4921-93fc-ee1e3882865an%40googlegroups.com.
