aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-07-09 20:48:54 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-07-09 20:48:54 +0200
commit3657843805a0911fd89b99171dd318218529a327 (patch)
tree1ef324358f0090905adf7eb1d55a12b9567e3ce4
parent39f93c8de5c67b7fc204e89b19421628b7f7f4c8 (diff)
downloadrefcat-3657843805a0911fd89b99171dd318218529a327.tar.gz
refcat-3657843805a0911fd89b99171dd318218529a327.zip
unstructured: cleanup obsolete regex
-rw-r--r--skate/unstructured.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/skate/unstructured.go b/skate/unstructured.go
index a12507a..f2c1d21 100644
--- a/skate/unstructured.go
+++ b/skate/unstructured.go
@@ -8,8 +8,7 @@ import (
var (
PatDOI = regexp.MustCompile(`10[.][0-9]{1,8}/[^ ]*[\w]`)
PatDOINoHyphen = regexp.MustCompile(`10[.][0-9]{1,8}/[^ -]*[\w]`)
- PatArxivPDF = regexp.MustCompile(`https?://arxiv.org/pdf/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`)
- PatArxivAbs = regexp.MustCompile(`https?://arxiv.org/abs/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`)
+ PatArxiv = regexp.MustCompile(`https?://arxiv.org/(pdf|abs)/([0-9]{4,4}[.][0-9]{1,8})(v[0-9]{1,2})?(.pdf)?`)
DOILinkPrefixes = []string{
"http://doi.org/",
"http://dx.doi.org/",
@@ -53,14 +52,9 @@ func ParseUnstructured(ref *Ref) error {
ref.Biblio.DOI = v
}
// Arxiv
- vs = PatArxivPDF.FindStringSubmatch(uns)
+ vs = PatArxiv.FindStringSubmatch(uns)
if len(vs) != 0 && ref.Biblio.ArxivId == "" {
- ref.Biblio.ArxivId = vs[1]
- } else {
- vs = PatArxivAbs.FindStringSubmatch(uns)
- if len(vs) != 0 && ref.Biblio.ArxivId == "" {
- ref.Biblio.ArxivId = vs[1]
- }
+ ref.Biblio.ArxivId = vs[2]
}
// XXX: ISBN
ref.Biblio.Extra.ISBN = ParseIsbn(uns)