I'm using Calibre to convert a PDF to MOBI, but it has trouble interpreting space-indented code blocks. The blocks contain a lot of spaces, but in a lot of different amounts. Some lines are even indented by 31 spaces.
Calibre allows for 3 regexes to do search and replace in the book before it's converted.
This is what I've tried.
\n( *) ( *)([a-zA-Z{};\*\/\(\)�-9])
Replace with:
\n\1 \2\3
The problem, it only replaces one of the spaces. I want them all replaced with the same abount of
.
I've also tried lazy versions of the first group etc.
Is this one of the cases where regular expressions are insufficient? I think this regex engine is the python standard.