I'm working with a tab-delimited file in BBEdit. The file looks like this:
00:15:50;11 text1 text2
00:35:17;03 text4 text5
00:35:20;03 text6
00:35:20;22 text7
Basically, it has: Timecode Tab Text Tab Text Etc
I want to take the second line of timecode and add it after the first line. I want it to look like this:
00:15:50;11 00:35:17;03 text1 text2
00:35:17;03 00:35:20;03 text4 text5
00:35:20;03 00:35:20;22 text6
00:35:20;22 text7
I've tried using this piece of GREP code:
FIND:
`(?-m)([0-9][0-9][; :][0-9][0-9][; :][0-9][0-9][; :][0-9][0-9])(.*)\r([0-9][0-9][; :][0-9][0-9][; :][0-9][0-9][; :][0-9][0-9])`
REPLACE:
'\1\t\3\2\r\3'
My problem is that it only searches and replaces every other line. If I do a find/replace all, it looks like this:
00:15:50;11 00:35:17;03 text1 text2
00:35:17;03 text4 text5
00:35:20;03 00:35:20;22 text6
00:35:20;22 text7
It's skipping every other line. I want to do a search/replace all in several hundred files. I'm wondering if there's something that I can change to make sure it gets every single line.
Thank you.
I took your regex and modified it slightly.
The trick is to not match the Timecode at the beginning of the line. So, use Positive Lookbehind.
(?<=([0-9][0-9][; :][0-9][0-9][; :][0-9][0-9][; :][0-9][0-9])) /*lookbehind to see if timecode exists, but dont match.
But, the use of parenthesis makes it the first capture group.*/
(.*)
\r
([0-9][0-9][; :][0-9][0-9][; :][0-9][0-9][; :][0-9][0-9])
Before,

After,

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With