2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 06:37:16 +00:00

AI comments on regexes

This commit is contained in:
2025-01-09 21:59:27 +00:00
parent 5b97cd83dd
commit 219b8b792e
2 changed files with 66 additions and 0 deletions

View File

@@ -139,6 +139,18 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
# print(f'# {tid}')
# print(f" - {tid} '{trippeople}' ")
"""
re.split(r",|\+|&|&(?!\w+;)| and ", trippeople)
, : The comma character
\+ : The plus sign (+); escaped to treat as a literal character
& : The literal string "&" (HTML-encoded ampersand)
&(?!\w+;) : An ampersand (&) not followed by one or more word characters (\w+) and a semicolon (;)
: Uses negative lookahead assertion (?!...) to ensure it's not part of an HTML entity like " "
and : The literal string " and " (with spaces before and after)
This will split the 'trippeople' string at any of these delimiters.
"""
for tripperson in re.split(r",|\+|&|&(?!\w+;)| and ", trippeople):
tripperson = tripperson.strip()
# author_u = re.match(r"(?i)<u>(.*?)</u>$", tripperson)