Hi
A regex could work, alternatively a combition of the 'explode' and 'array_slice' keyword modifers could also be used.
Just looking for a fullstop might be too simple though.
Would be reasonable to say that a terminal point character (or one followed by a quote mark) eg (. ! ? or ." !" ?" or .' !' ?') followed by a white space defines the end of a sentence.
This would be easy to implement. But it would break in cases of words abbreviated with a fullstop, or if a three fullstop ellipis is use in the middle of the sentence, or depending on how quoted text is added in the body of a sentence etc. Truly identifying a 'sentence' gets into the area of natural language processing.Though if this was to happen it wouldn't be much different to what you are doing by limiting the string to 20 words anyway
Create a regex asset and add:
/(?<=\.\s|!\s|\?\s|\."\s|!"\s|\?"|\.'\s|!'\s|\?'\s)(.|\s)*/
Leave the replacement empty. It will match everything after the first of any of the terminator characters followed be a white space but not include it, when the the matched text is replaced.
To implement you probably want to remove html, lines breaks and multiple spaces to make things work as expected:
%asset_metadata_[METADATA FIELD]^striphtml^replace:\s+: ^preg_replace:[REGEX ASSET ID]%
Thanks
Peter