http://www.perlmonks.org?node_id=1003421


in reply to Regex Doubt

I love to cheat (and I love to check too). Look at the last line of data

/i is said yet, so its use here is intentionally omitted

use strict; use warnings; while (<DATA>){ if (/([Bb]arton-[Ll]e-[Cc]lay|[Mm]ilton\s+[Kk]eynes|[Gg]lasgow|[Bb]art +on-le-[cC]lay \(near [Ll]utton\))\s?$/){ print $1,"\n"} else {print "-- what? --\n"} } __DATA__ Part Time - Weekend Receptionist - Barton le Clay - Barton-le-Clay (ne +ar Luton) Part-Time Weekend Day Veterinary Nurse - Milton keynes Receptionist - barton-le-clay (near luton) Full time liar - Glasgow (Australia)