@SmokeDetector @EliahKagan If you haven't looked at this one again, you may want to. It was edited during the grace period such that it's no longer R/A. Never mind. It was deleted just as I posted this.
@Makyen Sorry, I missed the edit. My R/A flag was declined though, so it shouldn't have a bad effect on the post author. I'm not sure if the post was self-deleted or deleted by a mod or high rep users (or through review).
@Makyen Yes, I know about that. I unset the i flag in such regexes myself with some regularity, using that same syntax. But that's the first- character. The pattern is (?-i:-5nKb9TvBa8)(?#YouTube) and I meant the second- character -- the one immediately preceding the 5 -- which unlike the first one is treated literally and is part of the match.
It's a non-word character and it appears on the very left edge of the part of the pattern that is actually matched, yet SmokeDetector succeeds in matching that - against a - in a URL where it is immediately preceded by an = character, which is also a non-word character.
To put it another way: my understanding from the documentation and testing is that SmokeDetector matches watchlist and blacklist patterns (other than from the username blacklist) only when they begin at a word boundary (or the very beginning of the input) and end at a word boundary (or the very end of the input).
Thus it seems to me that -5nKb9TvBa8 should not be matched immediately after =, since there is no word boundary in =- (both of them are non-word characters). Yet it is matched, at least with !!/test.
When I first saw that !!/watch command, I thought it was a mistake and that it would be necessary to use this style of regex to match it successfully. But it looks like that's not the case.
The practical significance of what I'm asking is, am I wrong to have thought I need to do something special when watching fragments of youtu.be URLs that begin with a hyphen? (But more broadly and whether the answer is yes or no, I am curious as to why the result of !!/test makes it appear unnecessary.)
@EliahKagan I'd like to be able to honestly say I was being tricky. However, the reality is that using that regex was a mistake. I'm clearly not operating at 100% at the moment and need either sleep or caffeine. Even though I copied the regex to include in my message above, and copied portions of it around, and edited it, I didn't actually notice that the matching portion started with a -. I'm sorry for the confusion.
As it turns out, the Unicode based word/non-word boundary, (?w:\b), detects a boundary between the = and the -. We use the Unicode based boundary, in addition to a normal \b, because the Unicode one helps regexes work closer to how the people creating the regexes expect them to with some non-Latin based languages. However, I wouldn't rely on having the =- transition be matched as a boundary. I'd suggest we keep assuming it's a normal \b.
Thanks for noticing the issue. I've adjusted the code I was using to convert YouTube URLs to watches to account for preceding and trailing - characters, so forgetting to double check shouldn't result in the same issue.