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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.