Skip to content

Commit

Permalink
Fix greedy Regex parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Oct 8, 2024
1 parent 401b103 commit f6c7f96
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions new_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@
break

OLD_VERSION_SUFFIX = f"(-{OLD_VERSION_TAG})?" if OLD_VERSION_TAG else ""
# The order of the alternatives is important, since the Regex parser
# should greedily include the old version suffix
OLD_VERSION_STR = \
f"({re.escape(OLD_VERSION_STR_README)})" + \
f"|({re.escape(OLD_VERSION_STR_CMAKE)}{OLD_VERSION_SUFFIX})"
f"({re.escape(OLD_VERSION_STR_CMAKE)}{OLD_VERSION_SUFFIX})" + \
f"|({re.escape(OLD_VERSION_STR_README)})"

print(f"The old version is: {OLD_VERSION_STR}")
print()
Expand Down

0 comments on commit f6c7f96

Please sign in to comment.