Calculating it may be too slow, but one reasonable measure is the length of the compiled version of the regular expression. You can get that printed to STDERR in Perl 5.10 with the re pragma. (I think you want the Debug DUMP option.) Unfortunately capturing that is hard, but in principle you can run it in an external process, capture the output, then look at it.