Maybe this is because I'm a newbie, or maybe it's because I'm trying to
modify RSS text. This is a perl script for a web site.

In any case, there's a feed that includes the author at the end of the
(looong) description. I'd like to limit the decsription to the first 20
words, add an ellipsis (...) and add the author's name, like so:

These are the first 20 words of this item, and it's really... By Joe Schmo.


My regex looks something like this:

(Save 1st 20 words):

/^(\w|\W){20}/g

(Save author tag - always starts with By and ends with period. I think this
will also ignore periods in middle initials):

/By\s?+\.$/g


My problem is that I can't figure out how to modify the string. I've even
tried $intro + "..." + $author, but that didn't work. I also tried a lot of
different constructions, like ($intro = $fullDesc) =~ /^(\w|\W){20}/g

If anyone could provide any insight (or a Regex for Dummies page), I'd
appreciate it.

Thanks.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to