private static Pattern compilePattern(String value, FromSourceLocation sourceLocation) {
        try {
            return Pattern.compile(value);
        } catch (PatternSyntaxException e) {
            throw new SourceException(
                    "Invalid pattern trait regular expression: `" + value + "`. " + e.getMessage(),
                    sourceLocation);
        }
    }
Gets the regex pattern.

@return returns compiled regular expression.
smithy-model/src/main/java/software/amazon/smithy/model/traits/PatternTrait.java