fork download
  1. library(stringr)
  2. data <- data.frame(
  3. text = c(" to $2.00 on an ongoing basis. the ongoing eps guidance excludes both a 68 cent-per-share charge associated with the establishment of the solutia-related reserve and a tax benefit of",
  4. " wheat and barley business. on a reported basis, eps is in the range of $1.56 to $1.71 per share for the full fiscal year. (for a reconciliation of ongoing... eps was 4.56 to 4.98",
  5. " the year ago quarter while 2004 full year eps was $.93, up 7.7% from 2003. return on equity was 21.7% for the fourth quarter and 20.4% for the full"
  6. )
  7. )
  8. res <- str_match_all(data$text, "\\beps\\b\\D*?(\\p{Sc}?\\d*\\.?\\d+(?:\\s*(?:to|[\\xAD\\p{Pd}])\\s*\\d*\\.?\\d+)?)")
  9. data$result <- lapply(res, function(x) paste(x[,-1], collapse="\n"))
  10. data
Success #stdin #stdout 0.24s 42384KB
stdin
Standard input is empty
stdout
                                                                                                                                                                                    text
1  to $2.00 on an ongoing basis. the ongoing eps guidance excludes both a 68 cent-per-share charge associated with the establishment of the solutia-related reserve and a tax benefit of
2     wheat and barley business. on a reported basis, eps is in the range of $1.56 to $1.71 per share for the full fiscal year. (for a reconciliation of ongoing... eps was 4.56 to 4.98
3                                    the year ago quarter while 2004 full year eps was $.93, up 7.7% from 2003. return on equity was 21.7% for the fourth quarter and 20.4% for the full
               result
1                  68
2 $1.56\n4.56 to 4.98
3                $.93