diff options
| author | Teddy Wing | 2022-06-25 16:40:08 +0200 |
|---|---|---|
| committer | Teddy Wing | 2022-06-25 16:40:08 +0200 |
| commit | 6204c785395ec2ec82a757180be1aa5a7e280f01 (patch) | |
| tree | 0384cd181dfcfe9f9408e66a84bf2245ed8ff85e | |
| parent | efac015cebeb9c20c1dea00d21e372cc64f2efe1 (diff) | |
| download | cws-status-6204c785395ec2ec82a757180be1aa5a7e280f01.tar.bz2 | |
cws-status: Match regex anywhere in the name
I didn't realise that `re.match()` only matches starting at the
beginning of the string rather than matching anywhere inside it:
https://docs.python.org/3/library/re.html#re.match
Switch to `re.search()` to get the desired behaviour.
| -rw-r--r-- | cws-status | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -90,5 +90,5 @@ item_statuses = tree.xpath('//table[//th[text()="Item"]]/tbody/tr/td[7]/text()') # Print the publish status for the queried extensions. for i, name in enumerate(item_names_versions): - if re.match(regex, name): + if re.search(regex, name): print(f'{name}\t{item_statuses[i]}') |
