Closed Konuchi closed 8 months ago
Why not use a regex instead if all you want to do is block videos with [ in the title?
/\[/gm
In the video title box on its own line should achieve this. Unless you're looking to understand how the advanced blocking feature works (I've not used it, so cannot comment).
\ takes the next character literally gm for global multiline match
Because I don't want to block the videos on the channel pages or in search.
(video, objectType) => { if (video.title.match("[")) { return true; } return false; }
Works here.
It's not working for me.
Is it an actual [ character or have they been sneaky and used a visually similar but different character?
It's an actual [ character. I copied and pasted to be sure.
"$" is also a special character for matching, you nead to dubbel escape it: if (video.title.match("\$20") return true; blocks videos containing "$20" in the title probobly the same shuld work for "["
That also does not work.
Have you tried using double backslash?
(video, objectType) => { if (video.title.match("\\[")) { return true; } return false; }
I just tested this with your example which did not work, but adding double backslash did for me.
string.match() uses a regex pattern and you need to escape both the bracket and the backslash for it to match a literal bracket.
That works. Thank you so much, also for explaining why it works.
This does not work: