R: split only when special regex condition doesn't match
How would you split at every and/ERT only when it is not succeded by "/V"
inside one word after in:
text <- c("faulty and/ERT something/VBN and/ERT else/VHGB and/ERT as/VVFIN
propositions one and/ERT two/CDF and/ERT three/ABC")
# my try - !doesn't work
> strsplit(text, "(?<=and/ERT)\\s(?!./V.)", perl=TRUE)
# Exptected return
[[1]]
[1] "faulty and/ERT something/VBN and/ERT else/VHGB and/ERT as/VVFIN
propositions one and/ERT"
[2] "two/CDF and/ERT"
[3] "three/ABC"
No comments:
Post a Comment