But this problem does not sound to me like a regex problem per se. I think you should back off from the code and explain your actual problem. For instance I suspect that something like the following untested code could be useful even though it sounds nothing like what you have written:
# Takes a string, returns hash of chars in string and # how many times each appears. sub char_count { my $str = shift; my %count; while ($str =~ /(.)/gs) { ++$count{$1}; } return %count; }
In reply to RE (tilly) 1: weighting regex patterns
by tilly
in thread weighting regex patterns
by MadraghRua
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |