MuiseDestiny / zotero-reference

PDF references add-on for Zotero.
GNU Affero General Public License v3.0
2.06k stars 59 forks source link

[bug] DOI regex: illegal characters following doi links will be captured #214

Open e-zz opened 11 months ago

e-zz commented 11 months ago

https://github.com/MuiseDestiny/zotero-reference/blob/e8ac96c070db533b541ab681d23c79482b696304/src/modules/utils.ts#L11-L13

how to reproduce

It might catch illegal characters following doi (like the comma in https://doi.org/10.1016/j.physletb.2023.138153,)

possible solution

Maybe appending a \b is better.

 DOI: /10\.\d{4,9}\/[-\._;\(\)\/:A-z0-9><]+[^\.\]]\b/,

example

Check the example here https://regex101.com/r/Bbdv5J/1

potential related bugs

And maybe we'd better do the same with arxiv or url regex

MuiseDestiny commented 11 months ago

Thanks!!!