See below. The regex assumes that you have a - in front of the location. If this is not necessarily the case you need to remove it from the regex. But then Mr Morrisville will create problems...
$name1 = 'Morrisville Jones-Ingham Executive and Sales Recruiting '; $name2 = 'Jones-Ingham Executive and Sales Recruiting - Morrisville, N +C, United States of America'; $location = "Morrisville"; $name1 =~ s/ - $location.*//; print $name1,"\n"; $name2 =~ s/ - $location.*//; print $name2,"\n";
In reply to Re: Regex Help!
by hdb
in thread Regex Help!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |