Hi, I'm a Regex newbie and I'm trying to figure this out, your help is most appreciated!
The platform I'm using is Yahoo! Pipes' Regex function -- documentation is here: http://pipes.yahoo.com/pipes/docs?doc=operators#Regex
What I'm trying to do is take the item.description from an RSS feed (stripped of all HTML using <[a-zA-Z\/][^>]*> ) and return an excerpt of the first 20 words (or so, it's not important how many exactly) followed by an ellipsis. The text can be multiple paragraphs.
In the library I found this expression to search for the first few words: ^([\s\S]){1,200}([\b\.])
The problem I'm having is that I can't figure out how to replace the *entire* text with just the excerpt. Yahoo's regex will only let me replace a search-string with a variable-string. So I need to either
A) split the text into two variables:
$1: The first 200 characters (without splitting up any words)
$2: The rest of the text
Then I can run a search for ($1)($2), and replace the whole text with just $1
or
B) Create a Regex that will search for the *last* chunk of text -- basically the inverse of ^([\s\S]){1,200}([\b\.])
Then I can replace that last chunk with an ellipsis.
I hope you'll be able to help -- thanks for your efforts!