Force users to type or paste correct form of string. Problem with inverting reg ex

I would like to force users to type or paste correct form of string like: a001 a025 F190 F500 GND UNL SFC

I've made a pattern to detect this type:

/(gdn|unl|sfc)|(a|f)[0-9]{1,3}/ig

However it need to be opposite/ inverted regular expression to replace everything not matched by my script:

checkAltitudePattern(e,i,control) {
    let val: string = e.target.value.toUpperCase();
    let pattern = /(gdn|unl|sfc)|(a|f)[0-9]{1,3}/ig;
    let patternVal = val.replace(pattern, "");
    //console.log("patternVal",patternVal)
    if (control === 'lowerAltitude') {
        this.AltFromControl(i).patchValue(patternVal);
    } else if (control === 'upperAltitude') {
        this.AltToControl(i).patchValue(patternVal);
    }
}

I would be gratefull if anyone could help. Regards