> But as you say, case folding is expensive. And with this approach you
> are going to case-fold every string that is matched against an rx
> that has some part of it that is case-insensitive.

That is correct in general. But regex compiler can be smarter than that.
For example, rx should optimize /a+/i to /[aA]+/ to avoid case-folding.
If it is too difficult for rx to do case-folding, I think it is better
to use some normalizer to do full-case folding.

> The case-folding should be done in the rx itself, at compile time if
possible.
> Then it is only done once, which will save a lot of time if the rx happens
> to be used in a loop or something.

The regular expression itself is case-folded at compile time. But I am
talking about input string here, not re.

Hong

Reply via email to