I have the html code I'm working with. I want to extract specific rows.
I want to extract this from line x using base R :coleman_l, SMOG4
Here is what I have:
x <- "<code>(hi)<a href=\"Read\">auto</a></code>(coleman_l, SMOG4)<br />Read</li>"
gsub("a></code>(.+?)<br", "a></code><br", x)
re <- "(?<=a></code>().*?(?=)<br)"
regmatches(x, gregexpr(re, x, perl=TRUE))
Error message:
> regmatches(x, gregexpr(re, x, perl=TRUE))
Error in gregexpr(re, x, perl = TRUE) :
invalid regular expression '(?<=a></code>().*?(?=)<br)'
In addition: Warning message:
In gregexpr(re, x, perl = TRUE) : PCRE pattern compilation error
'lookbehind assertion is not fixed length'
at ')'
enter code here
NOTE : marked as a regular expression, but it is a specific R-regular expression.
source
share