How to select multiple text-blocks in BBEdit?

1,016 views
Skip to first unread message

Vlad Ghitulescu

unread,
Nov 23, 2014, 8:00:57 PM11/23/14
to bbe...@googlegroups.com
Hello!


I have a list like this:


Chapter 1
1.1 title_of_tutorial_1.1 - 2m 3s
1.2 title_of_tutorial_1.2 - 4m 53s
(…)

Chapter 2
2.1 title_of_tutorial_2.1 - 12m 31s
2.2 title_of_tutorial_2.2 - 5m 5s
(…)


I would like to add to each of the lines with the tutorials (like "1.1 title_of_tutorial_1.1 - 2m 3s“ etc.) a „.m4v“ at the end.

I’ve found how to do this: I replace (with grep choosen) in the selected text a „$" with „.m4v“. 

So I begun selecting the text and applying this replace… and thinking if it is a possibility to make all of the selections at the beginning and only do the replace once at the end?

Thanks!


Regards,
Vlad


Christopher Stone

unread,
Nov 23, 2014, 9:54:45 PM11/23/14
to BBEdit-Talk
On Nov 23, 2014, at 06:56, Vlad Ghitulescu <Vl...@Ghitulescu.de> wrote:
I would like to add to each of the lines with the tutorials (like "1.1 title_of_tutorial_1.1 - 2m 3s“ etc.) a „.m4v“ at the end.
...
So I begun selecting the text and applying this replace… and thinking if it is a possibility to make all of the selections at the beginning and only do the replace once at the end?
______________________________________________________________________

Hey Vlad,

Any special reason you're selecting the text and not just doing a general find/replace?

Find:
(^[[:blank:]]*[\d.]+.+\d+m[[:blank:]]*\d+s)

Replace:
\1.md4

--
Best Regards,
Chris

Vlad Ghitulescu

unread,
Nov 24, 2014, 9:35:15 AM11/24/14
to bbe...@googlegroups.com
Hey, Chris!


Sorry, my fault: I forgot to tell that the „Chapter 1“ / „Chapter 2“ titles are almost similar to the tutorial-titles! 
They look like this:

1.0 Introduction - 8 lessons - 15m 23s
1.1 title_of_tutorial_1.1 - 2m 3s
1.2 title_of_tutorial_1.2 - 4m 53s
(…)
1.8 title_of_tutorial_1.8 - 2m 1s

2.0 Techniques - 12 lessons - 52m 24s 
2.1 title_of_tutorial_2.1 - 12m 31s
2.2 title_of_tutorial_2.2 - 5m 5s
(…)
2.12 title_of_tutorial_2.12 - 1m 1s

So yes, there is a reason! :-)


Regards,
Vlad



--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"sup...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.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 bbedit+un...@googlegroups.com.
To post to this group, send email to bbe...@googlegroups.com.

Christopher Stone

unread,
Nov 24, 2014, 8:17:40 PM11/24/14
to BBEdit-Talk
On Nov 24, 2014, at 01:13, Vlad Ghitulescu <Vl...@Ghitulescu.de> wrote:
Sorry, my fault: I forgot to tell that the „Chapter 1“ / „Chapter 2“ titles are almost similar to the tutorial-titles!  They look like this:

1.0 Introduction - 8 lessons - 15m 23s
1.1 title_of_tutorial_1.1 - 2m 3s
______________________________________________________________________

Hey Vlad,

That's not too hard to work with.

Assumes all chapters start with n…n.0:

Find:
^([[:blank:]]*\d+\.[1-9]\d*[\w[:blank:][:punct:]]+\d+m[[:blank:]]*\d+s)

Replace
\1.md4

Assumes only chapters contain the text 'n…n lessons':

Find:
^((?i)[[:blank:]]*\d+\.\d+(?>(?!\d+ lessons).)+\d+m[[:blank:]]*\d+s+$)

Replace
\1.md4

--
Best Regards,
Chris

Vlad Ghitulescu

unread,
Nov 25, 2014, 9:01:07 AM11/25/14
to bbe...@googlegroups.com
Hey, Chris!


Wow! Thanks!

I must learn to think like this - the regex is still not easy for me! :-/

But from the absence of the answers to my question I must conclude that I didn’t oversee any keystrokes / hidden menus and that there is actually no way to select two or more text-areas in a file with BBEdit, right?

Thanks again!


Regards,
Vlad


Christopher Stone

unread,
Nov 25, 2014, 5:13:16 PM11/25/14
to BBEdit-Talk
On Nov 25, 2014, at 00:20, Vlad Ghitulescu <Vl...@Ghitulescu.de> wrote:
I must learn to think like this - the regex is still not easy for me! :-/
______________________________________________________________________

Hey Vlad,

RegEx is not easy for most people when they start, but it gets better.  :)

there is actually no way to select two or more text-areas in a file with BBEdit, right?

I didn't understand that you wanted to select all relevant (and discontinuous) text at once and then do one find/replace on the selection.

As far as I know BBEdit does not support discontinuous selections.

--
Best Regards,
Chris

Reply all
Reply to author
Forward
0 new messages