bazz
02-18-2010, 06:13 PM
Hi,
my image files are labelled like this:
image01.jpg or image234.jpg or image01.gif or image01.png
The differences are in the numbers or the extension.
This regex appears to work:
next unless ($image_no =~ /^(image)(\d+)(.jpg|.gif|.png)+$/);
Not sure if it should be that or something like
next unless ($image_no =~ /^(image)(\d+).(jpg|gif|png)+$/);
How can we measure the greediness or other efficiency of a regex?
bazz
my image files are labelled like this:
image01.jpg or image234.jpg or image01.gif or image01.png
The differences are in the numbers or the extension.
This regex appears to work:
next unless ($image_no =~ /^(image)(\d+)(.jpg|.gif|.png)+$/);
Not sure if it should be that or something like
next unless ($image_no =~ /^(image)(\d+).(jpg|gif|png)+$/);
How can we measure the greediness or other efficiency of a regex?
bazz