Created
July 18, 2018 09:52
-
-
Save lengerfulluse/e66d28344480c6545e33c61ef92dea5a to your computer and use it in GitHub Desktop.
Simple usage of python with regex and backreference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/python | |
# sample of python regex with non-greedy(?) and back-reference(\1). | |
import re | |
pattern = re.compile(r'paymentContractId=(.*?)">\1'); | |
for i, line in enumerate(open('vbs-charged-backfill-orders.preprocessed')): | |
for match in re.finditer(pattern, line): | |
print match.group(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment