Regex за исключением [about:] страниц в Firefox

256
Anne

Я пытаюсь получить стильную таблицу стилей, которая будет отключена на страницах about:. Я считаю, что регулярное выражение ниже должно быть в состоянии сделать именно это, но Firefox, похоже, придерживается другого мнения. Может ли кто-нибудь указать мне правильное направление, пожалуйста?

@-moz-document regexp("(^(?=(?!about))).*") 
0

1 ответ на вопрос

0
pyrocrasty

One possibility is

@-moz-document regexp("^a?!(bout:).*|^[^a].*") 

However, testing your regex, it works for me in any case. Are you enclosing the rest of the script in braces afterwards?

@-moz-document regexp("(^(?=(?!about))).*") { /* rest of script */ } 

If so, you might have the wrong idea about what the about: url is matching. This only matches the page contents of about: pages. Note that any Firefox UI elements that are affected by your style will still be affected (even when you're visiting an about: page).

As an aside, it's convenient to use a simple userstyle like this for testing, so your script's behaviour won't complicate things when testing the regex.