If I have a magic Vim regex in a string literal, is there a way to convert the whole regex into an alternative representation that uses a different magic mode, so I could paste that equivalent regex into source code?
For instance, if I want to convert this magic-mode pattern:
'\m-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>'
to very-magic-mode to make it more readable, something like:
'\v-=<\d+L=>|0[xX][0-9a-fA-F]+>'
I often make mistakes trying to convert them by hand.
[0-9]+into a no magic one... ;-) – Kent Oct 12 '16 at 14:38\v(a|b)and\m\(a\|b\)are trivially the same, there's a 1-to-1 translation between those forms, and there may be an easy way to equality check those if there's not a good way to convert between them automatically. It's a tangent, though, I pbb shouldn't have brought it up. – Mu Mind Oct 14 '16 at 17:36