(Of course, by "first space to the left of" I meant "starting from the midpoint and moving leftwards, the first space you come to.")
On Sun, Feb 16, 2025 at 5:20 AM Mark Bowron <[email protected]> wrote: > I'm not a regexpert, so better answers are sure to follow, but you > probably want to start by changing the newline separating lines 3 and 4 to > a space. If your sample is representative, then regex can easily do this. > After first performing a non-regex replace to eliminate any spaces that > might immediately precede a newline, just regex-replace > > (.*)([a-zA-Z])\r (<------- it appears you might not need the > "A-Z" but it doesn't hurt) > > with > > \1\2[space] > > If I am not mistaken, you now want to change the first space to the left > of the midpoint to a newline. I am skeptical that regex is capable of > this, but maybe the regexperts can weigh in? Using BBEdit alone you might > have to settle for a solution that puts a fixed number of words on line 3 > and the remainder on line 4. > > As a longtime FileMaker Pro user, if I had to do this I'd import/export > everything into and out of FileMaker because it lets you identify where the > first space to the left of the midpoint is. > > Curious to hear what the more knowledgeable BBEdit users will have to say > about this! > > Cheers, > Mark > > On Sun, Feb 16, 2025 at 3:37 AM Otto Munters <[email protected]> > wrote: > >> Is there a regex to divide the last two lines of each subtitle more >> evenly in the following example, so that both sentences are about the same >> length, with preference given to the longest sentence on the 4th line. >> Example: >> 351 >> 00:18:23,120 --> 00:18:29,600 >> not that likes and dislikes are >> your enemies >> >> 352 >> 00:18:29,600 --> 00:18:31,960 >> because they end up serving >> the society. >> >> Thanks for your kind help! >> Otto >> >> -- >> 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 "[email protected]" 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 [email protected]. >> To view this discussion visit >> https://groups.google.com/d/msgid/bbedit/fd96bc86-4f53-49a2-8b77-ad5026c8998bn%40googlegroups.com >> <https://groups.google.com/d/msgid/bbedit/fd96bc86-4f53-49a2-8b77-ad5026c8998bn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Mark Bowron > 8600 Starboard Dr Apt 1127 > LAS VEGAS, NV USA 89117-3418 > +1 224-357-6070 > -- Mark Bowron 8600 Starboard Dr Apt 1127 LAS VEGAS, NV USA 89117-3418 +1 224-357-6070 -- 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 "[email protected]" 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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/bbedit/CACihOAvOZtktHm%3D_L1XW_KHRLo-vfcS%2BtWhNCTGXd0Pbfyzzjg%40mail.gmail.com.
