Skip to main content

Extract one or multiple substrings between two start and end strings.

Project description

string_grab

Extract one or multiple substrings between two start and end strings.

text = """Gender: female
       Race: White
       Birthday: 3/23/1973 (50 years old)
       Mobile: 715-523-1076
       Mobile: 715-563-3967
       Street: 4674 Lynn Avenue
       City, State, Zip: Eau Claire, Wisconsin(WI), 54701"""
from string_grab import grab

birthday = grab(text, start="Birthday: ", end=" (")
print(birthday)

>> "3/23/1973"
from string_grab import grab_all

for number in grab_all(text, start="Mobile: ", end="\n"):
    print(number)

>> "715-523-1076"
>> "715-563-3967"

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

string_grab-0.0.5.tar.gz (9.1 kB view hashes)

Uploaded Source

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