Ask questions. Get answers. Find technical product solutions from passionate experts in the NXLog community.

Regex string substitution and capture groups
I'm trying to do something like this, but I'm getting a literal "$1" substituted instead of the value of the capture group. if $data =~ s/(\[[^\]]+\])/"$1"/g log_info($1); $data ends up containing a "$1" while the log_info statement correctly logs the value of captured group $1. Is there a way to use s/// and capture groups in the substitution? I also tried \1 and \\1.

nimaimalle created
Replies: 1
View post »
last updated