Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hiya Monks,
I need your help in the following o get the output as mentioned for name1 output should be output1 and for name2 output should be output2. Pls suggest me a regex for this.
$name1 = 'Morrisville Jones-Ingham Executive and Sales Recruiting '; $name2 = 'Jones-Ingham Executive and Sales Recruiting - Morrisville, N +C, United States of America'; $output1 = 'Morrisville Jones-Ingham Executive and Sales Recruiting'; $output2 = 'Jones-Ingham Executive and Sales Recruiting';
"Morrisville" is the location. Basically, I dont want to delete anything if the location comes in front(as $name1), but if the location comes in middle($name2) I want to delete that location following with deleting whatever follows it. Can any monks pls suggest me a common regex for this in refer to 'Morrisville' as $location?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Help!
by choroba (Cardinal) on Apr 18, 2013 at 07:12 UTC | |
by hdb (Monsignor) on Apr 18, 2013 at 07:36 UTC | |
by choroba (Cardinal) on Apr 18, 2013 at 08:09 UTC | |
by hdb (Monsignor) on Apr 18, 2013 at 08:16 UTC | |
|
Re: Regex Help!
by hdb (Monsignor) on Apr 18, 2013 at 07:01 UTC | |
by hdb (Monsignor) on Apr 18, 2013 at 07:07 UTC |