use strict;
my $str = 'NOMEAR ISABELLE FERREIRA ZARONI, ID FUNCIONAL Nº
5100796-7, para exercer, com validade a contar de 16 de novembro
de 2020, o cargo em comissão de Assessor, símbolo DAS-7, da Sub-
secretaria de Concessões e Parcerias, da Secretaria de Estado de
Planejamento e Gestão, anteriormente ocupado por Vinicius dos San-
tos Silva, ID Funcional n° 5108029-0. Processo nº SEI-
1 2 0 0 0 1 / 0 1 4 6 11 / 2 0 2 0 .';
my $regex = qr/da\s+Secretaria\s+de\s+Estado\s+de\s+Planejamento\s+e\s+Gestão/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html