in reply to Quick Regex quesiton

I assume all the text is stored in $text. So you could use

if($test=~m/(\bdeferred|unrealized)(.*?\.){1,3}/s) {

Untested. Try it out. Note the s at the end to make sure that '.' matches also \n. You don't need that if the sentences are all on one line