简体   繁体   中英

How to insert \r with Visual Studio Regex find-replace

I would expect that to do a regex find-replace where you'd like to insert one backslash and one lowercase r you would type into the little regex replace box in visual studio \\\\r backslashbackslashr

in order to have one escaped backslash and then a lowercase r. However, it doesn't work that way. When you type \\\\r you get two backslashes instead of one backslash. And I know what you're thinking - if you type \\r :

在此处输入图片说明

you get a literal carriage return! How are you supposed to do it?

In your scenario, to replace foo with a literal \\r , turn off Use Regular Expressions in the Find/Replace box.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM