Snippet regex: match arbitrary number of groups and transform to CamelCase
In a Visual Studio Code Snippet I'm writing I want to convert a snake case string to camel case. From the docs I know that the syntax is '${' var '/' regex '/' (format | text)+ '/' options '}' so I've come up with this : ${TM_FILENAME_BASE/([a-z])([a-z]*)_+([a-z])([a-z]*)_+/${1:/upcase}$2${3:/upcase}$4/} This code however works only for strings with 2 elements (for exemple "carrot_cake") while I would like to process strings with arbitrary number of elements ("blueberry_pie_with_a_cup_of_coffee"). I guess that some kind of recursion is needed in 'regex' and 'format' , but I have no idea of