// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r##"(?m)^\s+\"#{prefix}\.(.+)\":"##).unwrap();
let string = "\"use strict\"
define ->
launchOptions = (prefix) ->
options =
\"#{prefix}.businessCredits.businessBudgetFacility\": functionDetails: functionId : \"be.kbc.businessCredits.businessBudgetFacility\", mode: \"create\"
\"#{prefix}.businessCredits.taxPrepaymentPlan\": functionDetails: functionId : \"be.kbc.businessCredits.taxPrepaymentPlan\", mode: \"create\"
\"#{prefix}.credits.privateCreditCardRequest.update\": functionDetails: functionId : \"be.kbc.credits.privateCreditCardRequest\", mode: \"update\"
\"#{prefix}.credits.homeAtOnce\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"createRequest\"
\"#{prefix}.credits.homeAtOnce.detailRequest\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"detailRequest\"
\"#{prefix}.credits.homeAtOnce.editRequest\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"editRequest\"
\"#{prefix}.credits.homeAtOnce.updateRequest\": functionDetails: functionId : \"be.kbc.credits.homeAtOnce\", mode: \"updateRequest\"
\"#{prefix}.credits.budgetfacilitylight\": functionDetails: functionId : \"be.kbc.credits.budgetFacilityLight\", mode: \"create\"
\"#{prefix}.credits.loaRequest\": functionDetails: functionId : \"be.kbc.credits.loaRequest\", mode: \"create\"
\"#{prefix}.credits.loaRequest.update\": functionDetails: functionId : \"be.kbc.credits.loaRequest\", mode: \"update\"
\"#{prefix}.doccle.doccleAccount\": functionDetails: functionId : \"be.kbc.doccle.doccleAccount\", mode: \"create\"
\"#{prefix}.esigning.esigning\": functionDetails: functionId : \"be.kbc.esigning.esigning\", mode: \"create\"
\"#{prefix}.esigning.esigning.createBundle\": functionDetails: functionId : \"be.kbc.esigning.esigning\", mode: \"createBundle\"
\"#{prefix}.home.dinoHomeInsurance\": functionDetails: functionId : \"be.kbc.home.dinoHomeInsurance\", mode: \"create\"
\"#{prefix}.home.energyRenovationAdvice\": functionDetails: functionId : \"be.kbc.home.era\", mode: \"create\"
\"#{prefix}.insurances.smallProducts\": functionDetails: functionId : \"be.kbc.insurances.smallProducts\", mode: \"create\"
\"#{prefix}.insurances.smallproducts.external\": functionDetails: functionId : \"be.kbc.insurances.smallProducts\", mode: \"create\"
\"#{prefix}.insurances.insurancesUpsell\": functionDetails: functionId : \"be.kbc.insurances.insurancesUpsell\", mode: \"create\"
\"#{prefix}.investments.buycooperativeshares\": functionDetails: functionId : \"be.kbc.investments.buyCooperativeShares\", mode: \"create\"
\"#{prefix}.savings.acceptSavingsAccount\": functionDetails: functionId : \"be.kbc.savings.acceptSavingsAccount\", mode: \"create\"
\"#{prefix}.savings.manageAccountInsurance\": functionDetails: functionId : \"be.kbc.savings.manageAccountInsurance\", mode: \"create\"
\"#{prefix}.savings.manageAccountInsurance.delete\": functionDetails: functionId : \"be.kbc.savings.manageAccountInsurance\", mode: \"delete\"
\"#{prefix}.savings.openSavingsAccount\": functionDetails: functionId : \"be.kbc.savings.openSavingsAccount\", mode: \"create\"
\"#{prefix}.savings.settleSavingsAccount\": functionDetails: functionId : \"be.kbc.savings.settleSavingsAccount\", mode: \"create\"
\"#{prefix}.payments.businessAccountRequest\": functionDetails: functionId : \"be.kbc.payments.businessAccountRequest\", mode: \"create\"
\"#{prefix}.payments.cardPhoto\": functionDetails: functionId : \"be.kbc.payments.cardPhoto\", mode: \"create\"
\"#{prefix}.payments.preaccountrequest\": functionDetails: functionId : \"be.kbc.payments.preAccountRequest\", mode: \"create\"
\"#{prefix}.payments.privateAccountRequest\": functionDetails: functionId : \"be.kbc.payments.privateAccountRequest\", mode: \"create\"
\"#{prefix}.payments.businessCreditCardRequest\": functionDetails: functionId : \"be.kbc.payments.businessCreditCardRequest\", mode: \"create\"
\"#{prefix}.payments.preCardRequest\": functionDetails: functionId : \"be.kbc.payments.preCardRequest\", mode: \"create\"
\"#{prefix}.payments.preCardRequest.createReplacement\": functionDetails: functionId : \"be.kbc.payments.preCardRequest\", mode: \"createReplacement\"
\"#{prefix}.vehicle.dinoCarInsurance\": functionDetails: functionId : \"be.kbc.vehicle.dinoCarInsurance\", mode: \"create\"
\"#{prefix}.vehicle.privateLease\": functionDetails: functionId : \"be.kbc.vehicle.privateLease\", mode: \"create\"
\"#{prefix}.vehicle.privateLease.update\": functionDetails: functionId : \"be.kbc.vehicle.privateLease\", mode: \"update\"
# Note: the deeplinks below are for local development testing only, the won't be available in the pillars
# coffeelint: disable=no_backticks
`//>>includeStart(\"local\", pragmas.local)`
options[\"#{prefix}.credits.genericRequest\"] = functionDetails: functionId : \"be.kbc.credits.genericRequest\", mode: \"create\"
options[\"#{prefix}.credits.genericRequest.continue\"] = functionDetails: functionId : \"be.kbc.credits.genericRequest\", mode: \"continue\"
`//>>includeEnd(\"local\")`
return options
return launchOptions
";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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 Rust, please visit: https://docs.rs/regex/latest/regex/