diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2025-01-09 21:59:27 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2025-01-09 21:59:27 +0000 |
commit | 219b8b792e2a6e1fb72b9e658b06395a50292e59 (patch) | |
tree | a9ba93662e00af43afff3c4cb5ba6ad386e4ca8b /parsers/logbooks.py | |
parent | 5b97cd83dd92ff506a40ac784d816a0be4bcc4eb (diff) | |
download | troggle-219b8b792e2a6e1fb72b9e658b06395a50292e59.tar.gz troggle-219b8b792e2a6e1fb72b9e658b06395a50292e59.tar.bz2 troggle-219b8b792e2a6e1fb72b9e658b06395a50292e59.zip |
AI comments on regexes
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 2ede83f..3d96b3b 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -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) |