I need a regexp string

Instead of being selfish and limiting this thread to what I want, I figured I would leave this open for other people to request regexp strings, because regexp simply blows my mind and many other people's minds as well.

Here's what I am talking about for the uninitiated;
-moz-document allows for regular expressions; basically, a combination of symbols with some text to target multiple related entities with one line. In the instance of my Google background style, I have this;
@-moz-document regexp("https?://(www|images|play)(?!docs)\.google\.com.*")
I have a fair idea of what this means; ?! means not (same as the :not token in CSS for IDs and classes), | means and (like a comma for selectors), but what ?, * and . means is above me. So instead of CSS noobs feeling frustrated, and those with a bad case of ADHD having to suffer through learning how to use regex for a style, I'll leave this as a place for noobs and those more experienced to exchange ideas and make requests. Speaking of, here's my first one:

I want a regexp string that says chrome://(everything except browser/content/browser.xul).
Reason being, I made a style that affects the Firefox preferences dialog, and I want it to cover more than just that, but it would be impossible to list all of the addons that use their own settings -- Knowing nodes are consistent, using regexp instead of url for -moz-document would be helpful.


  • edited September 2013
    | means or
    ? means 0 or 1 of the previous thing
    * means any amount of the previous thing
    . means any character
    (?!something) means the next thing doesn't start with "something"

  • It's my fault I wasn't entirely clear with my request -- That regexp string works for Firefox preferences, but not much else. Using FEBE as a test, I want the regexp to target all XUL entities except for browser/content/browser.xul. You know, like the option dialogs for FEBE and Tab Mix Plus. Probably just some small change in the regex you gave me.

    With such a sweeping change, I am sure this buckshot technique of targeting addresses will wreck something, so some instruction on other things to add might be necessary.

    As I was typing this, I found that I was having difficulty trying to access the chrome address for anything in FEBE from the web browser, and telling Firefox where the XUL file is in the local FS gives me a "Remote XUL" error, so that is mildly discouraging. I do hope you understand plainly what I'm shooting for. I do know the chrome address for Stylish's style management menu though...
  • Oh, I get it. I misplaced your parenthesis in my mind. It should be:

  • edited September 2013
    Yays! Thank you! Now I'm done with this.
  • edited September 2013
    A good quote on the subject :

    Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems.
  • edited September 2013
    If we were splitting hairs, a man by trhe name of D. Tilbrook (legends say) said it first about AWK. And from my experience on Linux, I whole-heartedly agree because acpi -t -f | cut -f1 -d. | cut -f2 -d, is a lot more readable then whatever awk string I got from #linux on freenode. (Might have it archived, huge timesink trying to find it.)

    That aside, there are times when regexp isn't the way to go. In my case, it was, since that string Jason gave me future-proofs my most recent style, accounting for the future. Though from what I have seen, I feel silly that I couldn't figure it out before (but someone said to me from #regex in the past an asterisk isn't automatic wildcard so that's where I gave up).

    regexp is highly useful for a website with a lot of pages you don't want to affect, or if you want to affect a majority except some group. Also useful for bulk rename, move and delete, though it's a tad bit more time-consuming depending on application. I do hope sensible people that discover regexp would really be useful utilize this thread, but I know some people will come in thinking they need @-moz-document regexp when url or domain (I think domain exists, does it?) would be more useful, especially for static lists and static links that very rarely change.

    Lots of people aren't willing to go into the timesink that is learning and practicing regexp (me included) so I made this thread for the masses who can't wrap their head around it, but find it would have practical application in whatever they're working on, for others to help and give themselves that warm, fuzzy feeling in their heart.
  • I'm not sure anyone here completely understands all of regular expressions. You can get pretty far just by learning the basics.
  • Hi! I would like to share with you information that could be very useful for busy entrepreneurs. Accounting services will help you ease your busy working days by providing you with the necessary accounting and tax assistance. I recommend that you use their services, especially since you will be assigned a personal specialist from Hong Kong.
Sign In or Register to comment.