in reply to Re: Regex Help!
in thread Regex Help!

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/;