fork download
  1. test_string <- c("15", "Table of Contents", "",
  2. "Item 7. Management’s Discussion and Analysis of Financial Condition and Results of Operations",
  3. "", "Lease Commitments", "The Company’s major facility leases are typically for terms not excees",
  4. "", "41", "Table of Contents", "", "Item 7A. Quantitative and Qualitative Disclosures About Market Risk",
  5. "", "Interest Rate and Foreign Currency Risk Management", "The Company regularly reviews its foreign exchange forward and option",
  6. "", "", "42", "Table of Contents", "", "Item 8. Financial Statements and Supplementary Data", "")
  7.  
  8. item7_pattern <- paste("^[[:blank:]]*([i|I]tem[[:blank:]]+7[^0-9a-z\"]*[m|M]anagement)",
  9. "([^0-9a-z]{0,3}s)?[[:blank:]]+[d|D]iscussions?[[:blank:]]+and",
  10. "[[:blank:]]+[a|A]nalysis[[:blank:]]+of[[:blank:]]+", sep="")
  11.  
  12.  
  13. grep(item7_pattern, test_string)
  14.  
Success #stdin #stdout 0.29s 40872KB
stdin
Standard input is empty
stdout
[1] 4