Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- references <- c(
- "Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, v. 3, no. 192, p. 71-199.",
- "Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, no. 3.",
- "Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, p. 71-199."
- )
- (?<=:)(?:[^:].*?)(?=(, v.)|(, no.)|(, p.))
- stringr::str_match(references, ": ((?!:)[^,:]*),")[,2]
- # [1] "Journal of Neverland" "Journal of Neverland" "Journal of Neverland"
- :s*K[^:]*?(?=,s*(?:v|no|p).)
- regmatches(references, regexpr(":\s*\K[^:]*?(?=,\s*(?:v|no|p)\.)", references, perl=TRUE))
- references <- c(
- "Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, v. 3, no. 192, p. 71-199.",
- "Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, no. 3.",
- "Dumitru, T.A., Smith, D., Chang, E.Z., and Graham, S.A., 2001, Uplift, exhumation, and deformation in the Japanese Mt Everest, Paleozoic and Mesozoic tectonic evolution of central Africa: from continental assembly to intracontinental deformation: Journal of Neverland, p. 71-199."
- )
- regmatches(references, regexpr(":\s*\K[^:]*?(?=,\s*(?:v|no|p)\.)", references, perl=TRUE))
- ## => [1] "Journal of Neverland" "Journal of Neverland" "Journal of Neverland"
- > str_extract(references, "(?<=:\s)[^:]*?(?=,\s*(?:v|no|p)\.)")
- [1] "Journal of Neverland" "Journal of Neverland" "Journal of Neverland"
- > str_match(references, ":\s*([^:]*?)(?:,\s*(?:v|no|p)\.)")[,2]
- [1] "Journal of Neverland" "Journal of Neverland" "Journal of Neverland"
- gsub('.*: (.*?), (?=v|no|p).*','\1', references, perl=TRUE)
- # [1] "Journal of Neverland" "Journal of Neverland" "Journal of Neverland"
- vapply(strsplit(references, ': *|, *', perl=TRUE),
- function (l) {
- k <- which(startsWith(l, 'p. ') | startsWith(l, 'v. ') | startsWith(l, 'no. '))
- k <- k[1] - 1
- return (l[k])
- }, character (1))
- # [1] "Journal of Neverland" "Journal of Neverland" "Journal of Neverland"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement