How to set @-moz-document for every page but not .html ones?

Hi!

I need to set @-moz-document working on every page but not ending ".html". For example:

http://example.com/example-page-id012345.html

Is it possible? I tried to use regexp method but without expected results.

Anyone could help me?

Comments

  • Select URLs matching the regexp with negative look-ahead: .*(?!\.html).{5}

    Or as a moz-format for classic Stylish:

    @-moz-document regexp(".*(?!\\.html).{5}") {
    
    }
    
  • edited October 3 Firefox

    The .{5] looks a bit hacky to me but should work (the .* matches the whole address up to .htm but not .html)

    I didn't test if it works, but .*(?>!\.html)$ looks a bit cleaner to me. But it uses negative lookbehind which may not be supported.

    Or maybe using the non-greedy quantifier .*?(?>!\.html)$?

    Actually more information leads to a better RegEx. Should https://www.example.com/index.html#anchor match or not?

    RegEx is always nice to learn and discuss :-)

Sign In or Register to comment.