I want to replace anything that has issue # 000... or issue #000... (note space between digits and pound sign) with an href url based on the digits part of that string. The ... represents any number of digits.
## Here is a MWE string:
News <- readLines(n=5)
CHANGES
* Fixed bug see GitHub issue #12
* Fixed bug see GitHub issue # 111. (John Doe)
News
## Here are the pieces of the href url
## Roots
roota <- "<a href=\"https://github.com/trinker/qdap/issues/"
rootb <- "\">"
rootc <- "</a>"
## Here's the desired output
c("CHANGES",
"",
"* Fixed bug see GitHub <a href=\"https://github.com/trinker/qdap/issues/12\">issue #12</a>" ,
"",
"* Fixed bug see GitHub <a href=\"https://github.com/trinker/qdap/issues/111\">issue #111</a>. (John Doe)"
)
## Here's my initial attempt at extracting the pieces
gsub("(.)(issue)(.[#])(\\s*)([0-9]+)", "\\1", News)
## Grabbing the digits I could almost paste them together with
paste(roota, DIGIT_GRABBED, rootb, "issue #, DIGIT_GRABBED, rootc)
*I marked this with a regex tag but note that R regex is a particular breed and you should be familiar with R if you answer.