0

Is it possible to make a Stylish style apply to: http://www.baka-tsuki.org/project/index.php?title=WHATEVER1:WHATEVER2 and (HTTPS version) https://www.baka-tsuki.org/project/index.php?title=WHATEVER1:WHATEVER2

given that:

WHATEVER1 has to fulfill the condition of not being any of these character combinations: Category, User, Meeting, User_talk, Baka-Tsuki, Special, Help, Template, Template_talk, Talk

and

WHATEVER2 has to fulfill the condition of not being any of these character combinations: Registration_Page, Updates, Archive

and

WHATEVER2 has to fulfill the condition of not ending as any of these character combinations: &action=edit, &action=history, &action=info, &printable=yes

I've tried:

regexp('https?://www\\.baka-tsuki\\.org/project/index\\.php\\?title=(?!(Category:|User:|User_talk:|Special:|Help:|Baka-Tsuki:|Template:|Template_talk:|Talk:|Meeting:)).*:(?!(Registration_Page|Updates|Archive)).*(?!(&action=history|&action=edit|&action=info|&printable=yes))')

But the (?!(Registration_Page|Updates|Archive)) and (?!(&action=history|&action=edit|&action=info|&printable=yes)) parts don't seem to work (the WHATEVER2 conditions).

Umaibo
  • 9
  • 1

1 Answers1

0

I changed the final lookahead to a lookbehind, to proceed an end anchor ($):

regexp('^https?://www\\.baka-tsuki\\.org/project/index\\.php\\?
title=(?!Category:|User:|User_talk:|Special:|Help:|Baka-Tsuki:|Template:|Template_talk:|Talk:|Meeting:)[^:]*
:(?!Registration_Page|Updates|Archive).*
(?<!&action=history|&action=edit|&action=info|&printable=yes)$')

I also removed some extraneous parens (they aren't needed with every alternation) and specified that it's non-colon characters ([^:]*) before the colon so it doesn't process past the colon.

Brian Stephens
  • 5,161
  • 19
  • 25
  • With your fix the (?!(Registration_Page|Updates|Archive)) part now works, but the (?!(&action=history|&action=edit|&action=info|&printable=yes)) part still doesn't work. – Umaibo Jul 11 '14 at 18:25
  • The style is applied when WHATEVER2 ends as &action=edit or &action=history or &action=info or &printable=yes, and it shouldn't. – Umaibo Jul 11 '14 at 18:32
  • You're right. I was reading my results wrong. I found the real problem: matching the final "bad" conditions needs to be a negative lookbehind, not a lookahead. I've edited my answer; try that. – Brian Stephens Jul 11 '14 at 18:39
  • With the current code the style is applied to everything, including the CSS editor, which "crashes" (it doesn't let me save the style). – Umaibo Jul 11 '14 at 18:47
  • Sorry, I don't have Stylish, so I can't try it there directly. It works in regex tools (like Regex Hero). Try putting back the parens around the alternations; maybe that's needed in Stylish for some reason. – Brian Stephens Jul 11 '14 at 19:07
  • Unfortunately, it doesn't work either. I will try other changes. Thanks, you've really helped me and I have new ideas now. – Umaibo Jul 11 '14 at 19:13