in reply to How do I extract a text between some delimiters
If you can be sure that it will also be in the <NPx> .. </NP> format, you can use this pseudo-code:
split the sentence on <NP\d> and </NP>; remove tags on the even elements; join the sentence elements again.
@parts = split(/<NP.*?>|<\/NP>/, $sentence); $even = 0; for $part (@parts) { if ($even) { $part =~ s/\/\w\w//g; $part .= '/NP'; } $even = ! $even; } $result = join('', @parts);
Untested!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I extract a text between some delimiters
by fglock (Vicar) on Sep 17, 2002 at 15:43 UTC | |
|
Re: Re: How do I extract a text between some delimiters
by Anonymous Monk on Sep 17, 2002 at 15:36 UTC |