Given what I've been led to believe are the penalities of using classes, why wouldn't one check the variable to see if it has just one entry and cast it differently...i.e., in a more regex-engine-efficient form?Because only in very unusual cases would the penalties amount to anything noticeable. And the extra code to treat one character specially means more opportunities for bugs as well as less readable/maintainable code.
In any case, the penalty is gone in 5.10.0 and will be gone in 5.8.9.
In reply to Re^3: Why would one want in a regex a class with only a single entry?
by ysth
in thread Why would one want in a regex a class with only a single entry?
by ack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |