[Israel.pm] Regex Tips

Yuval Yaari yuval at windax.com
Tue Feb 20 14:43:58 PST 2007


Shmuel Fomberg wrote:
> 1. When I do m/Literal/, Perl is running some very fast string search,
> instead on a regex.
>   

AFAIK (+ just checked with re.pm ;)) it still uses the same regex engine 
which creates a single node, and uses the "EXACT" regop.

Nodes are usually optimized *into* "EXACT" nodes, because it's a faster 
regop.
For example, m/[a]/ does not create an "ANYOF" node, but an "EXACT" node 
(just like m/a/ would).
(Ok, ok, this optimization is new so it's only in blead for now).

Sorry, I have been reading too much of `perldoc perlreguts` lately :-)

  ~Y



More information about the Perl mailing list