Search code examples
cssregexstylish

I can't get Stylish for Firefox to save my style, if it uses REGEXP in the url


I want to write a style the affects all websites I visit.

If I open the style with something like this,

@-moz-document url("") {

I can save my style, and Stylish puts the words "Can affect anything" under the saved style. But in practice, it doesn't seem to affect anything.

I can actually affect everything by changing the line to this:

@-moz-document regexp("*") {

But then when I click save, it refuses to save. The save button doesn't gray out, and if I close the stylish editor, the style isn't saved.

It appears to be specific to having regexp in there... anything else saves normally.

I read somewhere I could edit the file stylish.sqlite in my profiles folder directly, without an SQlite database editor, because the style is in plain text. So I tried doing that in notepad and saving. But then stylish just gives an error when I start firefox, about "Stylish is having problems opening its database".

How can I just make a style that affects every url?


Solution

  • A regex * is not valid since it is a quantifier without the pattern itself. You ask to match nothing/undefined value zero or more times.

    A symbol matching any character but a newline is .. Thus, you could try

    @-moz-document regexp(".*")
    

    However, a regex that may match empty string can lead to unexpected results.

    I suggest using

    @-moz-document regexp(".+")
    

    It will match 1 or more characters other than a newline.