In order to work with all possible subtitle sequence numbers you'll need to 
use \d+ instead of \d\d in your grep patterns so your two search patterns 
should be:

(^\d+\n\d.+\n.+)\n\n\d+\n\d.+\n([a-z]+[\W]*)\n

and

(^\d+\n\d.+ )(.+)\n(.+)\n\n\d+\n\d.+ (.+)\n([a-z]+[\W]*)\n

On Monday, April 7, 2025 at 4:12:23 PM UTC-7 Roland Küffner wrote:

> A similar but slightly shorter version:
>
> search:
> (^\d\d\n\d.+\n.+)\n\n\d\d\n\d.+\n([a-z]+[\W]*)\n
>
> replace:
> \1 \2\n
>
> - turn "Case sensitive" on
> - currently works only if the subtitle text is always on one line
> - currently does not account for differing amounts of empty lines between 
> the text blocks
> - the new end of the time stamp is deleted - if you can live with that …
>
> … if not, you could extend the pattern to replace that too
> search
> (^\d\d\n\d.+ )(.+)\n(.+)\n\n\d\d\n\d.+ (.+)\n([a-z]+[\W]*)\n
>
> replace
> \1\4\n\3 \5\n
>
> Regards, Roland
>
> On Sun, Apr 6, 2025 at 4:41 PM Otto Munters <[email protected]> wrote:
>
>> Example of a subtitle from which I want to move the single word in the 
>> second timestamp to the end of the subtitle in the first timestamp.
>> Is it possible to do that with a regex in BBedit? With Python or 
>> Applescript, I can't work.
>>
>> 50
>> 00:04:35,000 --> 00:04:42,840
>> However, what can happen is this can come at the cost of disregarding the 
>> larger
>>
>> 51
>> 00:04:42,840 --> 00:04:43,000
>> whole.
>>
>>
>> Thank you for helping me!
>> 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/2a6c9959-19e8-4aad-bad3-4b0c7973aa5an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/bbedit/2a6c9959-19e8-4aad-bad3-4b0c7973aa5an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/8e326293-1bf9-4c76-b2a4-4c0452ebdcbdn%40googlegroups.com.

Reply via email to