G'day Rahul Gupta,
Your underlying problem is that the value of $value in $query =~ s/$value/$replace/i is being interpolated: $Id and $name evaluate to zero-length strings so $query =~ s/$value/$replace/i is equivalent to $query =~ s//$replace/i (i.e. no substitutions occur). That was a poor guess on my part; see moritz' explanation instead; the fixes, however, are identical.
To fix, use
$query =~ s/\Q$value\E/$replace/i;
-- Ken
In reply to Re: Regex is not working
by kcott
in thread Regex is not working
by Rahul Gupta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |