On Monday, August 11, 2003, at 05:24 PM, Mark Powell wrote:

I have a string such as "now, that is a string!" But when I address word n
of the string, I get "now," (when n = 1) and "string!" for (when n = 5).
How can I point to a string and get only the nth word, without any
contiguous punctuation getting in the way?

Thanks in advance,

Mark Powell

You can't. ( word 1), ( word 2), ( word 3)... are created by empty space between groups of chars. I would use replace to strip unwanted punctuation from your results.

replace "," with empty in myChunk
replace ";" with empty in myChunk
replace quote with empty in myChunk
replace ":" with empty in myChunk
replace "!" with empty in myChunk

There's probably a slick way to do this with a Perl regEx though.

Reply via email to