I am looking for companies that relocated their headquarters. They usually disclose these details in their SEC filings. For example, their filings has the below text.
text <- "**<PAGE> 13
As a result of recurring losses in the UK operation, the Board of Directors
announced, during the first quarter of fiscal year 1999, the approval of a plan
to wind-down and discontinue the UK operation. The wind-down was completed in
May 1999. In addition, on September 30, 1998, the Company relocated its
corporate headquarters from
Wayne, Pennsylvania to Orlando, Florida. As a result of the wind-down of the UK operation and
the relocation of the corporate headquarters, the Company recorded charges of
approximately $3.5 million during fiscal year 1999. These charges primarily
relate to employee termination benefits and lease termination costs.**"
I am trying to extract the sentences that contain the words 'relocat' and 'headquarter' in the same sentence. In this case, the sentences are '[1] In addition, on September 30, 1998, the Company relocated its corporate headquarters from Wayne, Pennsylvania to Orlando, Florida.' and "[2] As a result of the wind-down of the UK operation and the relocation of the corporate headquarters, the Company recorded charges of approximately $3.5 million during fiscal year 1999."
I tried using grepl and gsub. But grepl returns only True or False, and gsub returns the whole text. Could you please help me extract just these two sentences? Below are the grepl and gsub statements I used. Thank you.
grepl("relocat[^\\.,!?:;]*headquarter|headquarter[^\\.,!?:;]*relocat",text)
gsub(".*?([^\\.]*(relocat*headquarter|headquarter*relocat)[^\\.]*).*","\\1",text, ignore.case=T, fixed=F)