You could try something like this:
#!/usr/bin/perl use strict; use warnings; $|++; use 5.010; my $before = 'foo'; my $after = 'stuff'; my $pattern = 'blablah'; my $combined = $before . $pattern . $after; my @test = qw( blahblahblah stuffstuffstuff fooblablahstuff fooblahblahstuff onefooblablahstuff ); match($_) for(@test); sub match { my $test = shift; say "$test matches" if( $test =~ /$combined/o ); }
In reply to Re: simple regex question
by phenom
in thread simple regex question
by pipeops
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |