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/r480Ps-10146i-B09AE384C29742AC9207715E0E594216%40Forest.local.