in reply to Re^2: Regex help
in thread Regex help
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
|
|---|