Skip to content

Commit e751d07

Browse files
committed
Improve regex expression
- Fix #5 - Take into account any old subject class instead of only quant-ph
1 parent 765e530 commit e751d07

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arxivbot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from maubot import Plugin
55
from maubot.handlers import command
66

7+
regex_expr = r'(https?://arxiv\.org/abs/(?:[a-z\-]*/)?[0-9]+\.?[0-9]+)'
78

89
class ArXivBot(Plugin):
910

@@ -49,7 +50,7 @@ async def _parse_arxiv(self, url):
4950
authors = ", ".join(authors)
5051
return {"title": title, "authors": authors, "date": date, "abstract": abstract, "pdf": pdf}
5152

52-
@command.passive(r'(https?://arxiv\.org/abs/(?:quant-ph/)?[0-9\.]+)', multiple=True, multiline=True)
53+
@command.passive(regex_expr, multiple=True, multiline=True)
5354
async def arxiv(self, evt, matches):
5455
for _, match in matches:
5556
d = await self._parse_arxiv(match)

0 commit comments

Comments
 (0)