I want to replace all the names of a specific variable in my script (such as the shift + enter in matlab). For exemple in the R script I could have:
var <- 1 + 2
var2 <- var * 5
That I want to change to :
var1 <- 1 + 2
var2 <- var1 * 5
The point is to avoid the "search an replace" that would have change the second variable in var12
.
Search for var(?![1:9])
and replace with var1
. Use regex search. The regex asserts that only var is matched which is not followed by any number.
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.