I need to format certain string in Sphinx's documentation H2 Header.


v-add-user should be replaced with

********* v-add-user *********

I search for needed string in Notepad++ (regex ^(v-.*)) and replace it with


in order to achieve the desired.

Current solution is pretty gruesome. Is there any way to optimize and simplify current solution or get another one, using Notepad++, sed, vim or any kind of software capable to perform such conversion? It also would be great if number of asterisks in the string-wrapper corresponds to the length of string being wrapped.


I don't find any compact solution, so I prefer to use sed to process sources.

I treat all of the matched strings with the following command.

sed -ri 's/^(v-.*)$/******\n\1\n******/' output.rst

It satisfies my needs for now.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.