I wouldn't have expected the i flag solution to be more efficient, but there you go. There are significant savings from +. The most efficient regex therefore is:
EDIT: You're right, tr/// is much faster.$str =~ s/[^a-z8-9 ]+//ig;
In reply to Re: regex to remove all non a-z and spaces
by TedPride
in thread regex to remove all non a-z and spaces
by coldfingertips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |