First '|' regexes are prety expencive,
You said that alterations are very expensive, but you can optimize such regexps using modules such as Regexp::List. perl has recently been patched to fix this problem.
But your program has a bug.
my $reg_ex = join( '|', @tags );
will never find tag '38=' if tag '3=' is also present. A common fix is to sort by descending length:
my $reg_ex = join( '|', sort { length($b) <=> length($a) } @tags );
The question now that remains is whether
31=aaaaaa38=bbbbbbb
should return
31 => 'aaaaaa', 38 => 'bbbbbbb'
or
31 => 'aaaaaa3', 8 => 'bbbbbbb'
if '38=' and '8=' are both in @tags.
In reply to Re^2: Message regex
by ikegami
in thread Message regex
by minixman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |