#!/usr/bin/perl use strict; use warnings; my $string = << "STRING_END"; RESULTADOS Y CLASIFICACIONES DE LA NBA STRING_END print "matched without modifier\n" if ($string =~ m{[^<]*RESULTADOS[^<]*}); print "matched with s modifier\n" if ($string =~ m{.*?RESULTADOS.*?}s);