class PostmanService {

    String removeSeverityTag(String name) {
        final Matcher matcher = SEVERITY_PATTERN.matcher(name);
        if (matcher.matches()) {
            // "@severity-high : real title" => " : real title"
            String strippedDownName = name.substring(matcher.group(1).length());
            // " : real title" or " - real title" => "real title"
            while (strippedDownName.length() > 0 && (Character.isWhitespace(strippedDownName.charAt(0)) || strippedDownName.charAt(0) == ':' || strippedDownName.charAt(0) == '-')) {
                strippedDownName = strippedDownName.substring(1);
            }
            if (strippedDownName.isEmpty()) {
                strippedDownName = "Untitled"; // Eg. "@severity-high : - " is not a name
            }
            return strippedDownName;
        }
        return name;
    }

}