Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I want to split the words with some separator and i want to retain the separator outside the tag. The separators are ,;—–Input:
keyword1, keyword2, keyword3, keyword4
The output i need is:
<keyword>keyword1</keyword>, <keyword>keyword2</keyword>, <keyword>key +word3</keyword>, <keyword>keyword4</keyword>
What i have tried is this:
my @key=map(("<KEYWORD>".$_."<\/KEYWORD>") , split(/(?=([,;]|—|–|‐))/,$key));Is this correct? i want to place the keywords alone inside the tag, spaces and separators should be placed outsid the tag.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split keywords
by holli (Abbot) on Mar 19, 2005 at 10:01 UTC | |
|
Re: split keywords
by graff (Chancellor) on Mar 19, 2005 at 16:22 UTC | |
|
Re: split keywords
by Anonymous Monk on Mar 19, 2005 at 10:45 UTC |