Here are two Perl solutions: The first one goes word by word, constructing an array made by the first leter of every word, then removes the acronym formed by those leters. It's fairly weak, and should fail if there's more than just the acronym and the letters per line - It also makes use of the (??{}) pattern to insert the acronym into the regex, which makes me queasy:
use strict;
use warnings;
use 5.010;
$_ = "Static application security testing (SAST)";
my @first;
s/
\b
(?<first>\p{L})\p{L}*
\b
(?{ push @first, $+{first} })
\K \s+ \(
(??{ join '', map { uc } @first; })
\)
//gx;
say;
Meanwhile, this solution first checks for something like an acronym, then constructs a regex to match as many words necessary:
$_ = "Static application security testing (SAST)";
my ($possible_acronym) = /\((\p{Lu}+)\)/;
my $regex = join '', map({ qr/\b(?i:$_)\p{L}*\b\s*?/ } split //, $possible_acronym), qr/\K\Q($possible_acronym)/;
s/$regex//;
say;
(I tried making a solution using (?(DEFINE)) patterns, such as tchrist's answer here, but failed miserably. Oh well.)
For more about (?:), named captures (?), \K, and a whole bunch of swell stuff, perlre is the answer.