use strict;
my $str = 'ISO 11784:1996/Amd.2:2010(E)
ISO 11784:2010(E)
ISO 11784:2010
ISO 11784-2-3-4:1996/Amd.2:2010(E)
ISO 11784-2-8-7:2010(E)
ISO 11784-5-120-78949-56-789:2010
BS EN ISO 11784:1996/Amd.2:2010(E)
EN ISO 11784:2010(E)
IS0 11784:2010
EN NP IS0 11784-2-3-4:1996/Amd.2:2010(E)
BS IS0 11784-2-8-7:2010(E)
EN NP ISO 11784-5-120-78949-56-789:2010
EN DIN 11784-5:2019(B)';
my $regex = qr/((?:bs )?(?:en )?(?:np )?(?:is[o0]|DIN)\s+[-\d]+:)(.+:)?(\d{4}(?:\(\w\))?)/imp;
my $subst = '$1$3';
my $result = $str =~ s/$regex/$subst/rg;
print "The result of the substitution is' $result\n";
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