>perl -wMstrict -le "my $s = 'xyz table 1 table tablet table2 fig 3 fig figer fig4 zyx'; print qq{'$s'}; ;; $s =~ s{ (?= (?: table | fig) \s* \d+) }{