newbio has asked for the wisdom of the Perl Monks concerning the following question:
As part of a problem, I am trying to do the following but cannot come up with a real nice solution. I tried to do this using both regex and otherwise but could not do it correctly.
Input sentence to program: The seller has the following *fruit* types: ( *apples* , *oranges* , *pears* , *berries* , and *mangoes* ).
Output: The seller has following *fruit* types: *(#apples#,#oranges#,#pears#,#berries#and#mangoes#)*.
The input can have two optional variants: no parenthesis, and/or no comma before 'and' in the sentence, also the number of fruits is a variable with a minimum value of 2 fruits - the output should change accordingly.
Thanks very much in advance.
Raj
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: string matching
by BrowserUk (Patriarch) on Aug 01, 2009 at 02:23 UTC | |
by newbio (Beadle) on Aug 01, 2009 at 18:55 UTC | |
by BrowserUk (Patriarch) on Aug 01, 2009 at 19:20 UTC | |
|
Re: string matching
by halfcountplus (Hermit) on Aug 01, 2009 at 04:14 UTC | |
|
Re: string matching
by Anonymous Monk on Aug 01, 2009 at 02:55 UTC |