With Regex::Replace we can use $1, $2, ... to match corresponding groups. But how can I use $1 followed by number. Eg to replace 6 with 678?
Regex::Replace(text, "(6)", '$178');
您需要使用备用语法:
Regex::Replace(text, "(6)", "${1}78");
You can use backreferences to capture a named group and replace that named group with whatever you want. view this link
好像我可以用$`
Regex::Replace(text, "(6)", '$1$`78');
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.