Skip to main content

String pattern matching with placeholders.

Project description

ezptn

Overview

  • String pattern matching with placeholders.
  • プレースホルダーを使った文字列パターンマッチ

Usage

import ezptn

res = ezptn.match("lambda %s: %s", "lambda a: a ** 2")
print(res)	# -> [('a', 'a ** 2')]
res = ezptn.match("%s:%s", "13:12:24")
print(res)	# -> [('13', '12:24'), ('13:12', '24')]
res = ezptn.match("%s--%s", "hoge-fuga")
print(res)	# -> []
res = ezptn.match("%squid", "equid")
print(res)	# -> [('e',)]
res = ezptn.match("%s(%s)", "hoge(22)")
print(res)	# -> [('hoge', '22')]
res = ezptn.match("%s(%s)", "hoge()")
print(res)	# -> [('hoge', '')]
res = ezptn.match("%s(%s)", "hoge()", allow_empty = False)
print(res)	# -> []
res = ezptn.match("(%s,((%s,%s),%s))", '(23,(("s",44),44))')
print(res)	# -> [('23', '"s"', '44', '44')]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezptn-0.0.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

ezptn-0.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file ezptn-0.0.1.tar.gz.

File metadata

  • Download URL: ezptn-0.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.8

File hashes

Hashes for ezptn-0.0.1.tar.gz
Algorithm Hash digest
SHA256 24a5a9f8de44f500008d8cff138a8f71f9559f2240345cf65b3215ec89e16685
MD5 2b3b4fad6ebb54e6a46786f595aca754
BLAKE2b-256 f2cba5792179c6fdf3b442260d516bd3ef0e3621c20507fae3a6e4e3f734dee0

See more details on using hashes here.

File details

Details for the file ezptn-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ezptn-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.8

File hashes

Hashes for ezptn-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59756ea38cfbbaa3cbdad3999043a1c2d41bf86ef8cce4402571d21676d28d1a
MD5 73b9b33a6610376ab083b03dbb5ff309
BLAKE2b-256 23f5cc6f639e3581fbf3a02f1bf85fc95639e37366b5f782ed88978be210fb6c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page