http://www.perlmonks.org?node_id=1055633


in reply to Regular expression with multiple lines

There must be something else going on. I tested your second code and it works for me:
#!/usr/bin/perl use warnings; use strict; my $content = 'Fields of activity: Legal basis:'; my $d_fieldofactivity = 'missing'; if ($content =~ /Fields \s of \s activity: (.*) Legal/xs) { $d_fieldofactivity = $1; } print "(( $d_fieldofactivity ))\n";

Output:

(( ))
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ