How To Un-CamelCase Part Of A String?

I have long markdown lists of images like:
![116-BowlOfApples](./media/116-BowlOfApples.jpg)

I want to un-CamelCase the caption but not the filename
to get this result:
![116-Bowl Of Apples](./media/116-BowlOfApples.jpg)

I’m using:
(?<=[a-z])(?=[A-Z])
&1 &2

and I get
![Bowl Of Apples-VI](./media/Bowl Of Apples-VI.jpg)

How Can I limit this regex to what’s in square brackets and leave the filename as is?

  • 1

    Can you please edit this question and show us the desired result please as it is a bit ambiguous. thanks

    – 

  • 1

    What is the programming language you are using?

    – 

  • Or, where are you doing this? What tool?

    – 

  • Wictor, Perl, or whatever else that does lookaround; though I would be happier with Vim. I just saw your answer to replacing chars between square breackets but not between parenthesis. Thanks.

    – 

  • What is &1 &2

    – 

Leave a Comment