So @context contains search strings? (This is why it's important to give a runable piece of code, including sample input. It takes the guessing out of the game.)
my @contexts = qw( demo-outgoing demo ); local $_ = 'foo demo-outgoing bar'; my $regexp = join('|', map { quotemeta($_) } @contexts); s/($regexp)/__user__${1}__/g; print("$_\n"); # foo __user__demo-outgoing__ bar
In reply to Re^3: Regex help
by ikegami
in thread Regex help
by snacktime
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |