r-lib / desc

Manipulate DESCRIPTION files
https://desc.r-lib.org/
Other
122 stars 27 forks source link

search_for_author() fails when input contains special characters for regexp #150

Open ThierryO opened 4 months ago

ThierryO commented 4 months ago
>   this_description$del_author("Research Institute for Nature and Forest (INBO)")
Could not find author to remove.

escaping special characters solves the problem

>   this_description$del_author("Research Institute for Nature and Forest \\(INBO\\)")
Author removed: Research Institute for Nature and Forest (INBO) .

DESCRIPTION

Authors@R: c(
    person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"),
    person("Research Institute for Nature and Forest (INBO)", , , "info@inbo.be", role = c("cph", "fnd"))
  )

https://github.com/r-lib/desc/blob/22c0258145077c0436643153bafe056ea81f2651/R/authors-at-r.R#L124

gaborcsardi commented 4 months ago

Yes, indeed that argument is interpreted as a regular expression. I am not sure what you expect to happen in this case.

Maybe we could have a better message if no authors could be removed and the input has some special characters?