Skip to content

Label filtering matches too much #114

@Natrium729

Description

@Natrium729

When filtering the label to remove segments, the regex matches the first hyphen it finds, possibly removing parts of the title.

For example, if listening to "Trans-Europa Express - 2009 Remaster" (Kraftwerk) with "remaster" filtered out, the first hyphen matches and the track is displayed as "Trans".

A possible fix (that I haven’t tested) is to replace the first .* in this line of label.js

const filterRegex = new RegExp("(?:-|\\(|\\[).*(?:" + sanitizedInput.replace(",","|") + ").*(?:$|\\)|\\])","gi");

with

[^-\\(\\[]*

that is, a run of something that doesn’t contain hyphens or opening brackets, so that we only match the last hyphen or bracket. (My regex is a bit rusty, I might have made some mistakes.)

Thanks for the extension otherwise! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions