Skip to content

Commit ef36523

Browse files
authored
Fix regex pattern for citedby_url extraction
- Prefix the string literal with an r - ( m = re.search(r"cites=[\d+,]*", object["citedby_url"]) - This tells Python to treat backslashes literally, preventing them from being interpreted as escape sequence initiators. - Fix: scholarly/_scholarly.py:312: SyntaxWarning: invalid escape sequence '\d' m = re.search("cites=[\d+,]*", object["citedby_url"])
1 parent ae36174 commit ef36523

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scholarly/_scholarly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def citedby(self, object: Publication)->_SearchScholarIterator:
309309

310310
def _citedby_long(self, object: Publication, years):
311311
# Extract cites_id. Note: There could be multiple ones, separated by commas.
312-
m = re.search("cites=[\d+,]*", object["citedby_url"])
312+
m = re.search(r"cites=[\d+,]*", object["citedby_url"])
313313
pub_id = m.group()[6:]
314314
for y_hi, y_lo in years:
315315
sub_citations = self.search_citedby(publication_id=pub_id, year_low=y_lo, year_high=y_hi)

0 commit comments

Comments
 (0)