The regex below deletes the location and everything following if it is not at the start of the string. It does not remove the -. A single space at the start would suffice though to get the location at the beginning removed.
$name1 =~ s/(.+)$location.*/$1/;
In reply to Re^2: Regex Help!
by hdb
in thread Regex Help!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |