#!/usr/bin/perl use strict; my $term = "\"foo\"[MH] OR \"bar\"[MH]"; my @matches = ( $term =~ /\"(.+)?\"\[MH\]/ ); print $_,"\n" foreach (@matches);