This is fine if your graphics software went haywire and you really do have all those permutations. But otherwise you have to check for at least two options at each step--and you already know that one of those options will never apply. If j then never P; if J then never p. Isn't it faster to say "Once you're got the first letter, each subsequent test only has one possible match"? Does it take more time for the server to read those 10-15 extra bytes and parse a few more pipes?
Msg#: 4555962 posted 12:17 pm on Mar 19, 2013 (gmt 0)
I've never tested it personally. And I would imagine even if I did the results may be different on different setups depending on the regex engine implemented at compile time. I, for one, would be interested to hear/see your results if you decide to undertake the task :P
Msg#: 4555962 posted 9:57 pm on Mar 19, 2013 (gmt 0)
depending on the regex engine implemented at compile time
Matter of fact that's the biggest variable I can think of. Not "regex engine" but "compile time". In a config file, Regular Expressions are parsed once, at startup, and then cached. In htaccess they are parsed all over again each time the server meets them. So you could have a setup where Task A takes more time than Task B -- but doing Task A once takes less time than doing Task B many times.
Does "look for 'P' or 'p'" take more time than "look for 'P'" alone? Once you get deep into the bowels of the computer, I doubt there's any inherent connection between P and p. The [NC] has triggered some previous function that tells it to match up 50 and 70. Or 80 and 112, as the case may be.
I don't think I could test it without leading to irate form letters from the host ;) Apparently they tell you when you are using excessive RAM and need to look into a VPS. And despite all the times I've managed to break a php include-- most recently yesterday-- or created a perpetual-motion error,* I've always done it without placing undue strain on server resources.
* <ot> There exists at least one circumstance where RewriteRule (.*) $1 does not lead to an infinite loop. This was an entertaining discovery; I've put it in the Trick Questions bin alongside "The light turned green so I had to wait longer". </ot>