# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^\s+\"#{prefix}\.(.+)\":"
test_str = ("\"use strict\"\n\n"
"define ->\n\n"
" launchOptions = (prefix) ->\n"
" options =\n"
" \"#{prefix}.businessCredits.businessBudgetFacility\": functionDetails: functionId : \"be.kbc.businessCredits.businessBudgetFacility\", mode: \"create\"\n"
" \"#{prefix}.businessCredits.taxPrepaymentPlan\": functionDetails: functionId : \"be.kbc.businessCredits.taxPrepaymentPlan\", mode: \"create\"\n"
" \"#{prefix}.credits.privateCreditCardRequest.update\": functionDetails: functionId : \"be.kbc.credits.privateCreditCardRequest\", mode: \"update\"\n"
" \"#{prefix}.credits.homeAtOnce\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"createRequest\"\n"
" \"#{prefix}.credits.homeAtOnce.detailRequest\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"detailRequest\"\n"
" \"#{prefix}.credits.homeAtOnce.editRequest\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"editRequest\"\n"
" \"#{prefix}.credits.homeAtOnce.updateRequest\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"updateRequest\"\n"
" \"#{prefix}.credits.budgetfacilitylight\": functionDetails: functionId : \"be.kbc.credits.budgetFacilityLight\", mode: \"create\"\n"
" \"#{prefix}.credits.loaRequest\": functionDetails: functionId : \"be.kbc.credits.loaRequest\", mode: \"create\"\n"
" \"#{prefix}.credits.loaRequest.update\": functionDetails: functionId : \"be.kbc.credits.loaRequest\", mode: \"update\"\n"
" \"#{prefix}.doccle.doccleAccount\": functionDetails: functionId : \"be.kbc.doccle.doccleAccount\", mode: \"create\"\n"
" \"#{prefix}.esigning.esigning\": functionDetails: functionId : \"be.kbc.esigning.esigning\", mode: \"create\"\n"
" \"#{prefix}.esigning.esigning.createBundle\": functionDetails: functionId : \"be.kbc.esigning.esigning\", mode: \"createBundle\"\n"
" \"#{prefix}.home.dinoHomeInsurance\": functionDetails: functionId : \"be.kbc.home.dinoHomeInsurance\", mode: \"create\"\n"
" \"#{prefix}.home.energyRenovationAdvice\": functionDetails: functionId : \"be.kbc.home.era\", mode: \"create\"\n"
" \"#{prefix}.insurances.smallProducts\": functionDetails: functionId : \"be.kbc.insurances.smallProducts\", mode: \"create\"\n"
" \"#{prefix}.insurances.smallproducts.external\": functionDetails: functionId : \"be.kbc.insurances.smallProducts\", mode: \"create\"\n"
" \"#{prefix}.insurances.insurancesUpsell\": functionDetails: functionId : \"be.kbc.insurances.insurancesUpsell\", mode: \"create\"\n"
" \"#{prefix}.investments.buycooperativeshares\": functionDetails: functionId : \"be.kbc.investments.buyCooperativeShares\", mode: \"create\"\n"
" \"#{prefix}.savings.acceptSavingsAccount\": functionDetails: functionId : \"be.kbc.savings.acceptSavingsAccount\", mode: \"create\"\n"
" \"#{prefix}.savings.manageAccountInsurance\": functionDetails: functionId : \"be.kbc.savings.manageAccountInsurance\", mode: \"create\"\n"
" \"#{prefix}.savings.manageAccountInsurance.delete\": functionDetails: functionId : \"be.kbc.savings.manageAccountInsurance\", mode: \"delete\"\n"
" \"#{prefix}.savings.openSavingsAccount\": functionDetails: functionId : \"be.kbc.savings.openSavingsAccount\", mode: \"create\"\n"
" \"#{prefix}.savings.settleSavingsAccount\": functionDetails: functionId : \"be.kbc.savings.settleSavingsAccount\", mode: \"create\"\n"
" \"#{prefix}.payments.businessAccountRequest\": functionDetails: functionId : \"be.kbc.payments.businessAccountRequest\", mode: \"create\"\n"
" \"#{prefix}.payments.cardPhoto\": functionDetails: functionId : \"be.kbc.payments.cardPhoto\", mode: \"create\"\n"
" \"#{prefix}.payments.preaccountrequest\": functionDetails: functionId : \"be.kbc.payments.preAccountRequest\", mode: \"create\"\n"
" \"#{prefix}.payments.privateAccountRequest\": functionDetails: functionId : \"be.kbc.payments.privateAccountRequest\", mode: \"create\"\n"
" \"#{prefix}.payments.businessCreditCardRequest\": functionDetails: functionId : \"be.kbc.payments.businessCreditCardRequest\", mode: \"create\"\n"
" \"#{prefix}.payments.preCardRequest\": functionDetails: functionId : \"be.kbc.payments.preCardRequest\", mode: \"create\"\n"
" \"#{prefix}.payments.preCardRequest.createReplacement\": functionDetails: functionId : \"be.kbc.payments.preCardRequest\", mode: \"createReplacement\"\n"
" \"#{prefix}.vehicle.dinoCarInsurance\": functionDetails: functionId : \"be.kbc.vehicle.dinoCarInsurance\", mode: \"create\"\n"
" \"#{prefix}.vehicle.privateLease\": functionDetails: functionId : \"be.kbc.vehicle.privateLease\", mode: \"create\"\n"
" \"#{prefix}.vehicle.privateLease.update\": functionDetails: functionId : \"be.kbc.vehicle.privateLease\", mode: \"update\"\n\n"
" # Note: the deeplinks below are for local development testing only, the won't be available in the pillars\n"
" # coffeelint: disable=no_backticks\n"
" `//>>includeStart(\"local\", pragmas.local)`\n"
" options[\"#{prefix}.credits.genericRequest\"] = functionDetails: functionId : \"be.kbc.credits.genericRequest\", mode: \"create\"\n"
" options[\"#{prefix}.credits.genericRequest.continue\"] = functionDetails: functionId : \"be.kbc.credits.genericRequest\", mode: \"continue\"\n"
" `//>>includeEnd(\"local\")`\n\n"
" return options\n\n"
" return launchOptions\n")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html