简体   繁体   中英

VS Code, find/replace access find results in the replace field

I have phone numbers on my file and I would like to surround each of them with braces, so if I have this:

"+49-1111"
"+49-2222"

I would like to run a replace operation and to get this:

["+49-1111"]
["+49-2222"]

Is that possible with the current vs code find/replace action? If it is a dup sorry but I could find any explanation anywhere. Thanks

This is more relevant to regular expression.

Find ("\\+\\d{2}-\\d{4}") , replace the occurrences with [$1]

Be sure to turn the "Use Regular Expression" switch on.

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