I'm trying to perform a simple operation: take a file and put "> " at the front of every line. However, when I try to use Visual Studio Code to do it, the regular expression "^" doesn't match all the lines. In particular, it matches:
This makes no sense to me, I'm told it uses Rust's regular expression engine but I can't see anything in the documentation that would suggest this would happen.
Why does this happen and how do I fix it?
This is what happens if I try "^.".
The Visual Studio text editor has a Regex implementation. You could populate this with some of your data and develop your Regex expression manually before you code it. I'm looking at Visual Studio Code (an MS product) on Linux and using the equivalent of
Search ^(.*)$ Replace >$1
in the editor I may have solved your problem.
-999
{42
uuu
AAA
becomes
>-999
>{42
>
> uuu
>AAA
This Regex technique is called group capturing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With