asbplayer icon indicating copy to clipboard operation
asbplayer copied to clipboard

Allow selection of useful regex filter presets

Open killergerbah opened this issue 2 years ago • 4 comments

From Coruja:

Thoughts on providing some sane defaults for the subtitle regex filter ? I was thinking something like ^-?[.+]$|^[♪♬#~〜]+$ where the first half ^-?[.+]$ captures descriptive lines between braces eg

[THUNDER RUMBLING] -[GASPS]

and the 2nd half ^[♪♬#~〜]+$ removes general misc symbols used as music etc

From ZyphDoz:

apparently, js regex needs to use [一-龯ぁ-ゟ゠-ヿ] instead of [\p{Han}\p{Hiragana}\p{Katakana}].

I always thought regex syntax looked awful but this is getting to a point where I almost can't tell the difference between this (?<![一-龯ぁ-ゟ゠-ヿ])(|((?![^一-龯ぁ-ゟ゠-ヿ]))[^))](?:)|)) and this https://esolangs.org/wiki/Brainfuck 😆 if this thing actually works as intended it could be good preset if you're going to add presets. (it should remove parenthesis and everything inside them except when the parenthesis is for the reading of a kanji (it currently looks like it's working but the whole thing is crafted by chatgpt so you never know))

From russgrav:

Another quick question, but I've been using \

([^)])|([^)]) to get rid of parenthesis but I'd like to also use \n if possible, which removes all newlines so that each line is all in one -- is there a way to combine both of these regex conditions?

killergerbah avatar May 03 '23 01:05 killergerbah

Design: Add menu above "subtitle regex filter" setting called "subtitle regex preset". The first option in the menu should be "No preset." The rest should include the options in the issue description: "Sound effects," "furigana" etc. If a user selects one of the preset options, it should auto-populate the regex filter setting with the corresponding regex. If the user starts typing in the regex filter text box, the preset menu should automatically select "No preset."

killergerbah avatar Mar 08 '25 00:03 killergerbah

Will work on this!

5byuri avatar Mar 15 '25 18:03 5byuri

@killergerbah

Image

wouldn't a combobox with autocomplete be a better design choice? firstly it would remove an additional textfield, if users write a regex it already gets suggestions for other regex and can just continue type their own regex if they want a custom regex

5byuri avatar Mar 17 '25 08:03 5byuri

@5byuri Sorry I completely forgot to reply to this. One benefit of the preset feature would be to help users who don't know how to write regexes in the first place. These users would have no way of knowing what to type into the auto-complete box to get what they need. A simple menu would work around that.

I could see the autocomplete box working if it could be opened up and display all the "natural language representations" ("no parentheses", "no sound effects," etc) to the user, instead of the plain regex representations.

killergerbah avatar Mar 28 '25 22:03 killergerbah