import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "jjj[0-9]+(\\.[0-9][0-9]?)";
final String string = "03-Feb-2021\n"
+ "Mr./Ms. JOHN THACHIL\n"
+ "MADHURA SURAKSHA APARTMENT\n"
+ "S6 2ND FLOOR\n"
+ "JP NAGAR 5TH PHASE\n"
+ "BANGALORE 560078\n"
+ "Dear Customer, \n"
+ "Subject: EasyEMI on your HDFC Bank Credit Card Number:jjj552260XXXXXX0961\n"
+ "We are pleased to grant you the EasyEMI payment facility as per the details stated below. The\n"
+ "transaction amount has been converted into EasyEMI as per your request\n"
+ "EasyEMI Loan no. 0000000000065214714\n"
+ "Unsecured Loan Type EasyEMI\n"
+ "Amount Rs.3399.00\n"
+ "Tenure 3 Months\n"
+ "EasyEMI Fixed Finance Charges on Reducing Balance 1.25% p.m.\n"
+ "EMI Amount Rs.1161.44(Excluding GST)*\n"
+ "Merchant Name \n"
+ "Processing Fee Rs.199.00\n"
+ "*GST at 18% will be charged on the following and are subjected to change as per Govt.Announcement:\n"
+ "1.EasyEMI Finance Charges Component on the EMI amount on a monthly basis\n"
+ "2.Processing fee, if any\n"
+ "3.Pre-closure charges, if any\n"
+ "Please refer to the enclosed amortization schedule for EMI details\n"
+ "For the first EMI, the interest will be calculated from the loan booking date till the payment due date. This\n"
+ "is effective only for loans booked from Feb 2019 onwards.In case you require any further assistance , pls\n"
+ "contact Phone Banking within 7 days of receiving this letter\n"
+ "EasyEMI transactions are not eligible for Reward Points.This EasyEMI can be pre-closed anytime during the\n"
+ "tenure. In case of pre-closure of the EasyEMI facility, there will be no Penalty levied currently. As the pre-closure\n"
+ "charge is subjected to change, we request you to get in touch with your nearest call centre for the applicable\n"
+ "charge, if any, if you decide to pre-close the EasyEMI. Partial pre-payment or partial closure is not permitted on\n"
+ "this loan\n"
+ "Additional Finance Charges if any on the principal outstanding from last statement date till date of loan pre-\n"
+ "closure need to be paid by customer.\n"
+ "Please also note that the above mentioned EMI amounts will be included to your monthly HDFC Bank Credit Card\n"
+ "statements and will be payable as part of the Minimum Amount Due.\n"
+ "If your HDFC Bank Card gets closed before all the installments have been charged, the loan outstanding will get\n"
+ "debited to your card account and you’re expected to pay the amount in full. In case of default in payment of credit\n"
+ "card dues or EMIs by the due dates, your card account is liable to be suspended and could further be terminated.\n"
+ "The terms and conditions contained in the Cardmember Agreement apply over and above the terms and\n"
+ "conditions for this loan. In case you do not agree to any of the details above, or require any further assistance,\n"
+ "please contact the nearest customer service call centre at the numbers provided below, within 7 days of receiving\n"
+ "this letter.\n"
+ "Enclosed Amortization schedule of Loan Number 0000000000065214714 for Loan Amount Rs.3399.00\n"
+ "(*GST extra @18% on Interest Component)\n"
+ "NojjjNo\n"
+ "EasyEMIjjjEasyEMI\n"
+ "StatementjjjPrincipaljjjEMIjjjBalancejjjStatementjjjPrincipaljjjEMIjjjBalance\n"
+ "FinancejjjFinance\n"
+ "DatejjjAmountjjjAmountjjjDatejjjAmountjjjAmount\n"
+ "ChargesjjjCharges\n"
+ "onjjjon\n"
+ "ReducingjjjReducing\n"
+ "BalancejjjBalance\n"
+ "21-02-2021jjj21-04-2021\n"
+ "1jjj1118.96jjj70.88jjj1189.84jjj2280.04jjj3jjj1147.10jjj14.33jjj1161.43jjj0.00\n"
+ "21-03-2021\n"
+ "2jjj1132.94jjj28.50jjj1161.44jjj1147.10\n"
+ "This is a computer generated letter and does not require a signature.";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html