> Note: I tried running the search string variable through the "qr" function, but that did not help.
qr helps
#!/usr/bin/perl use strict; use warnings; my ($text, $search); $text = "\\x1\\x2\\x3\\x4"; $search = qr/x2\\.+\\x4/; print "\nUsing variable in regex: (qr)\n"; print "Before: text = $text\n"; $text =~ s/$search/new/; print " After: text = $text\n"; __END__ Using variable in regex: (qr) Before: text = \x1\x2\x3\x4 After: text = \x1\new
L*
In reply to Re: Regex Search String in a Variable
by Discipulus
in thread Regex Search String in a Variable
by roho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |