I need to extract some numbers from a text. Text is
x <- "Lorem ipsum dolor sit amet[245], consectetur adipiscing (325). Deinde prima illa, quae in congressu[232]. solemus: Quid tu, inquit, huc? Sequitur disserendi ratio cognitioque 295. naturae;"
The numbers to be extracted are 325 and 232. These are inside brackets and at the end of sentence. Other numbers are excluded. I tried strsplit(text, "[A-Za-z]+")
, but is not getting what I needed.