Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update arXiv regex #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,12 @@ var Utilities = {

// Next try arXiv
if (!identifiers.length) {
// arXiv identifiers are extracted without version number
// i.e. 0706.0044v1 is extracted as 0706.0044,
// because arXiv OAI API doesn't allow to access individual versions
let arXiv_RE = /((?:[^A-Za-z]|^)([\-A-Za-z\.]+\/\d{7})(?:(v[0-9]+)|)(?!\d))|((?:\D|^)(\d{4}\.\d{4,5})(?:(v[0-9]+)|)(?!\d))/g;
// arXiv identifiers are extracted with and without version number
// i.e. 0706.0044v1 is extracted as [0706.0044v1, 0706.0044, 1]
let arXiv_RE = /\b(([-A-Za-z.]+\/\d{7}|\d{4}\.\d{4,5})(?:v(\d+))?)(?!\d)/g; // 1: full ID, 2: ID without version, 3: version #
let m;
while ((m = arXiv_RE.exec(text))) {
let arXiv = m[2] || m[5];
let arXiv = m[1];
if (arXiv && !foundIDs.has(arXiv)) {
identifiers.push({arXiv: arXiv});
foundIDs.add(arXiv);
Expand Down