I was reading a Meditations node, by moritz. The subject was The cost of unchecked best practices.
His discussion was related to some issues with respect to best practices and some code strategies of another monk in another posting.
But, as a part of his discussion he noted:
This optimization is not performed for char classes with single entries.
I understand completely what moritz was talking about; but his comment got me to thinking and peaked my curiosity.
Classes in regexes, I am told, are somewhat slow (I believe the tend to cause a lot of backtracking as it tests the various alternatives in the class until it finds one that matches...or until none are found to match). The moritz comment leads me to believe that there are, for some programmers, a value to having a regex class with only a single entry; but I don't see the value.
My question is: Why would one want a class with a single entry in a regex?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |