if-else idiom for regex
Project description
MatchState
This package provide a idiom:
import re from typing import Match, Union from matchstate import MatchState m = MatchState() # type: Union[MatchState, Match] if m.match(re.compile(r'apple'), 'applx'): print('apple:', m.group()) elif m.match(r'orange', 'orange'): print('orange:', m.group()) else: print('No match')
Or you may use the MatchState class directly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size matchstate-1.0.1-py3-none-any.whl (1.8 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size matchstate-1.0.1.tar.gz (1.5 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for matchstate-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16ade07d58919499478732001d06b89078284e4c4f4e422768099badd88b0db5 |
|
MD5 | 47178a1903bc44d9397060ca88a897cc |
|
BLAKE2-256 | 4562f54757d849c3364dd6fed46c12e4d4502529fc9df756c4bb78e0af67fbbf |