class FhirToDhisOptionSetUtils {

    @Nullable
    public static String getIntegerOptionCode( @Nullable String code, @Nullable Pattern pattern )
    {
        if ( (code == null) || (pattern == null) )
        {
            return code;
        }

        final Matcher matcher = pattern.matcher( code );
        if ( !matcher.matches() )
        {
            return null;
        }
        if ( matcher.groupCount() != 1 )
        {
            throw new TransformerScriptException( "Pattern to resolveRule integer options must have exactly one group: " + pattern.pattern() );
        }
        return matcher.group( 1 );
    }

    private  FhirToDhisOptionSetUtils();

}