package net.knarcraft.ffmpegconverter.utility; import org.jetbrains.annotations.NotNull; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * A helper class for subtitle-related tasks */ public final class SubtitleHelper { private SubtitleHelper() { } /** * Checks whether the given subtitle is a songs & signs subtitle * * @param subtitleTitle

The subtitle to check

* @return

True if the subtitle is a songs and signs, not a full subtitle

*/ public static boolean isSongsSignsSubtitle(@NotNull String subtitleTitle) { Pattern pattern = Pattern.compile("(^| |\\(|\\[\\{|/|\\[)si(ng|gn)s?($|[ &/+-@])+(titles)?[ &/+-@]?(songs?)?|" + "(^| |\\(|\\[\\{|/)songs?($|[ &/+-@])+(si(gn|ng)s?)?|.*forced.*|.*s&s.*"); Matcher matcher = pattern.matcher(subtitleTitle.toLowerCase().trim()); return matcher.find(); } }