Example usage for java.util.regex Matcher groupCount

List of usage examples for java.util.regex Matcher groupCount

Introduction

In this page you can find the example usage for java.util.regex Matcher groupCount.

Prototype

public int groupCount() 

Source Link

Document

Returns the number of capturing groups in this matcher's pattern.

Usage

From source file:net.antoinecomte.regex.RegExTesterApplication.java

private void showResult(String regexValue, String textValue) {
    Matcher matcher;
    try {//  ww w . j a  v  a2 s  . co  m
        result.setVisible(!"".equals(regexValue));
        Label match = new Label("no match");
        match.addStyleName("h3 color");
        result.removeAllComponents();
        result.addComponent(match);
        matcher = Pattern.compile(regexValue).matcher(textValue);
        if (matcher.matches()) {
            if (matcher.groupCount() > 0)
                for (int i = 1; i <= matcher.groupCount(); i++) {
                    Label g = new Label("group " + i + " = " + matcher.group(i));
                    g.addStyleName("h3 color");
                    g.setSizeUndefined();
                    result.addComponent(g);
                }
            match.setValue("match");
        }
        matcher.reset();
        if (matcher.find()) {
            Label findresult = new Label("find=true, start = " + matcher.start() + " end = " + matcher.end());
            findresult.addStyleName("h3 color");
            result.addComponent(findresult);
        }
        Label javaString = new Label("java string : \"" + StringEscapeUtils.escapeJava(regexValue) + "\"");
        javaString.addStyleName("small color");
        result.addComponent(javaString);
    } catch (Exception e) {
        result.removeAllComponents();
        Label error = new Label(e.getMessage());
        error.addStyleName("error");
        result.addComponent(error);
    }
}

From source file:com.cs.fabric.sdk.utils.ClientConfig.java

private ClientConfig() {

    // Default values

    defaultProperty(GOSSIPWAITTIME, "5000");
    defaultProperty(INVOKEWAITTIME, "100000");
    defaultProperty(DEPLOYWAITTIME, "120000");
    defaultProperty(PROPOSALWAITTIME, "120000");

    //////// ww w .  j  av a2s.  c o  m
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.mspid", "Org1MSP");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.domname", "org1.example.com");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.ca_location", "http://localhost:7054");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.peer_locations",
            "peer0.org1.example.com@grpc://localhost:7051, peer1.org1.example.com@grpc://localhost:7056");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.orderer_locations",
            "orderer.example.com@grpc://localhost:7050");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.eventhub_locations",
            "peer0.org1.example.com@grpc://localhost:7053,peer1.org1.example.com@grpc://localhost:7058");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.mspid", "Org2MSP");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.domname", "org2.example.com");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.ca_location", "http://localhost:8054");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.peer_locations",
            "peer0.org2.example.com@grpc://localhost:8051,peer1.org2.example.com@grpc://localhost:8056");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.orderer_locations",
            "orderer.example.com@grpc://localhost:7050");
    defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.eventhub_locations",
            "peer0.org2.example.com@grpc://localhost:8053, peer1.org2.example.com@grpc://localhost:8058");

    defaultProperty(INTEGRATIONTESTSTLS, null);
    runningTLS = null != sdkProperties.getProperty(INTEGRATIONTESTSTLS, null);
    runningFabricCATLS = runningTLS;
    runningFabricTLS = runningTLS;

    for (Map.Entry<Object, Object> x : sdkProperties.entrySet()) {
        final String key = x.getKey() + "";
        final String val = x.getValue() + "";

        if (key.startsWith(INTEGRATIONTESTS_ORG)) {

            Matcher match = orgPat.matcher(key);

            if (match.matches() && match.groupCount() == 1) {
                String orgName = match.group(1).trim();
                sampleOrgs.put(orgName, new SampleOrg(orgName, val.trim()));

            }
        }
    }

    for (Map.Entry<String, SampleOrg> org : sampleOrgs.entrySet()) {
        final SampleOrg sampleOrg = org.getValue();
        final String orgName = org.getKey();

        String peerNames = sdkProperties.getProperty(INTEGRATIONTESTS_ORG + orgName + ".peer_locations");
        String[] ps = peerNames.split("[ \t]*,[ \t]*");
        for (String peer : ps) {
            String[] nl = peer.split("[ \t]*@[ \t]*");
            sampleOrg.addPeerLocation(nl[0], grpcTLSify(nl[1]));
        }

        final String domainName = sdkProperties.getProperty(INTEGRATIONTESTS_ORG + orgName + ".domname");

        sampleOrg.setDomainName(domainName);

        String ordererNames = sdkProperties.getProperty(INTEGRATIONTESTS_ORG + orgName + ".orderer_locations");
        ps = ordererNames.split("[ \t]*,[ \t]*");
        for (String peer : ps) {
            String[] nl = peer.split("[ \t]*@[ \t]*");
            sampleOrg.addOrdererLocation(nl[0], grpcTLSify(nl[1]));
        }

        String eventHubNames = sdkProperties
                .getProperty(INTEGRATIONTESTS_ORG + orgName + ".eventhub_locations");
        ps = eventHubNames.split("[ \t]*,[ \t]*");
        for (String peer : ps) {
            String[] nl = peer.split("[ \t]*@[ \t]*");
            sampleOrg.addEventHubLocation(nl[0], grpcTLSify(nl[1]));
        }

        sampleOrg.setCALocation(
                httpTLSify(sdkProperties.getProperty((INTEGRATIONTESTS_ORG + org.getKey() + ".ca_location"))));

        if (runningFabricCATLS) {
            String cert = "src/test/fixture/sdkintegration/e2e-2Orgs/v1.1/crypto-config/peerOrganizations/DNAME/ca/ca.DNAME-cert.pem"
                    .replaceAll("DNAME", domainName);
            File cf = new File(cert);
            if (!cf.exists() || !cf.isFile()) {
                throw new RuntimeException("TEST is missing cert file " + cf.getAbsolutePath());
            }
            Properties properties = new Properties();
            properties.setProperty("pemFile", cf.getAbsolutePath());

            properties.setProperty("allowAllHostNames", "true");// testing
            // environment
            // only NOT
            // FOR
            // PRODUCTION!

            sampleOrg.setCAProperties(properties);
        }
    }

}

From source file:org.apache.brooklyn.entity.database.mysql.InitSlaveTaskBody.java

private Future<ReplicationSnapshot> createMasterReplicationSnapshot(final MySqlNode master,
        final String dumpName) {
    log.info("MySql cluster " + cluster + ": generating new replication snapshot on master node " + master
            + " with name " + dumpName);
    String dumpOptions = SNAPSHOT_DUMP_OPTIONS + " --master-data=2" + getDumpDatabases(master);
    ImmutableMap<String, String> params = ImmutableMap.of(ExportDumpEffector.PATH.getName(), dumpName,
            ExportDumpEffector.ADDITIONAL_OPTIONS.getName(), dumpOptions);
    DynamicTasks.queue(Effectors.invocation(master, MySqlNode.EXPORT_DUMP, params));
    return DynamicTasks.queue("get master log info from dump", new Callable<ReplicationSnapshot>() {
        @Override//from w  w  w  . ja  v a  2s . c om
        public ReplicationSnapshot call() throws Exception {
            Pattern masterInfoPattern = Pattern.compile(
                    "CHANGE MASTER TO.*MASTER_LOG_FILE\\s*=\\s*'([^']+)'.*MASTER_LOG_POS\\s*=\\s*(\\d+)");
            String masterInfo = DynamicTasks
                    .queue(execSshTask(master, "grep -m1 'CHANGE MASTER TO' " + dumpName,
                            "Extract master replication status from dump").requiringZeroAndReturningStdout())
                    .asTask().getUnchecked();
            Matcher masterInfoMatcher = masterInfoPattern.matcher(masterInfo);
            if (!masterInfoMatcher.find() || masterInfoMatcher.groupCount() != 2) {
                throw new IllegalStateException("Master dump doesn't contain replication info: " + masterInfo);
            }
            String masterLogFile = masterInfoMatcher.group(1);
            int masterLogPosition = Integer.parseInt(masterInfoMatcher.group(2));
            ReplicationSnapshot replicationSnapshot = new ReplicationSnapshot(master.getId(), dumpName,
                    masterLogFile, masterLogPosition);
            cluster.sensors().set(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT, replicationSnapshot);
            return replicationSnapshot;
        }
    });
}

From source file:ca.sqlpower.architect.ddl.TypeMap.java

/**
  * populate the rules from mappingrules.properties
 *//*ww  w.  ja v a 2 s.  c  o  m*/
protected TypeMap() {
    // make root node
    databases = new TreeMap();
    //XXX add header.
    // look for 7 groups on non-whitespace seperated by whitespace
    Pattern p = Pattern.compile(
            "^([\\S]+)[\\s]+([\\S]+)[\\s]+([\\S]+)[\\s]+([\\S]+)[\\s]+([\\S]+)[\\s]+([\\S]+)[\\s]+([\\S]+)[\\s]*");
    BufferedReader br = null;
    try {
        String line = null;
        br = new BufferedReader(new FileReader("mappingrules.properties"));
        while ((line = br.readLine()) != null) {
            if (line.trim().length() == 0) {
                continue;
            }
            if (line.trim().length() > 0 && line.trim().substring(0, 1).equals("#")) {
                continue;
            }
            Matcher m = p.matcher(line);
            m.find();
            if (m.groupCount() != 7) {
                logger.error("badly formatted line in mappingrules.properties:\n" + line);
            } else {

                MappingRule rule = new MappingRule();

                rule.setDatabase(m.group(1));
                rule.setNativeType(m.group(2));
                rule.setCompField(m.group(3));
                rule.setCompCondition(m.group(4));
                rule.setCompValue(m.group(5));
                rule.setModifyField(m.group(6));
                rule.setModifyValue(m.group(7));

                if (logger.isDebugEnabled()) {
                    logger.debug("adding rule: " + rule);
                }

                addRule(rule);

            }
        }
    } catch (IOException ie) {
        logger.error("IO error loading typemap", ie);
    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                logger.error("IO error loading typemap", e);
            }
        }
    }

}

From source file:ch.uzh.fabric.config.TestConfig.java

private TestConfig() {
    File loadFile;//from   w  w  w .j  a v a  2  s  .  c om
    FileInputStream configProps;

    try {
        loadFile = new File(System.getProperty(ORG_HYPERLEDGER_FABRIC_SDK_CONFIGURATION, DEFAULT_CONFIG))
                .getAbsoluteFile();
        logger.info(String.format("Loading configuration from %s and it is present: %b", loadFile.toString(),
                loadFile.exists()));
        configProps = new FileInputStream(loadFile);
        sdkProperties.load(configProps);

    } catch (IOException e) { // if not there no worries just use defaults
        //            logger.warn(String.format("Failed to load any test configuration from: %s. Using toolkit defaults",
        //                    DEFAULT_CONFIG));
    } finally {

        // Default values
        defaultProperty(GOSSIPWAITTIME, "5000");
        defaultProperty(INVOKEWAITTIME, "100000");
        defaultProperty(DEPLOYWAITTIME, "120000");

        //////
        defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.mspid", "Org1MSP");
        defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.domname", "org1.example.com");
        defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.ca_location", "http://172.17.0.1:7054");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.peer_locations", "peer0.org1.example.com@grpc://172.17.0.1:7051, peer1.org1.example.com@grpc://172.17.0.1:7056");
        defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.peer_locations",
                "peer0.org1.example.com@grpc://172.17.0.1:7051");
        defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.orderer_locations",
                "orderer.example.com@grpc://172.17.0.1:7050");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.eventhub_locations", "peer0.org1.example.com@grpc://172.17.0.1:7053,peer1.org1.example.com@grpc://172.17.0.1:7058");
        defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg1.eventhub_locations",
                "peer0.org1.example.com@grpc://172.17.0.1:7053");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.mspid", "Org2MSP");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.domname", "org2.example.com");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.ca_location", "http://172.17.0.1:8054");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.peer_locations", "peer0.org2.example.com@grpc://172.17.0.1:8051,peer1.org2.example.com@grpc://172.17.0.1:8056");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.orderer_locations", "orderer.example.com@grpc://172.17.0.1:7050");
        // defaultProperty(INTEGRATIONTESTS_ORG + "peerOrg2.eventhub_locations", "peer0.org2.example.com@grpc://172.17.0.1:8053, peer1.org2.example.com@grpc://172.17.0.1:8058");

        defaultProperty(INTEGRATIONTESTSTLS, null);
        runningTLS = null != sdkProperties.getProperty(INTEGRATIONTESTSTLS, null);
        runningFabricCATLS = runningTLS;
        runningFabricTLS = runningTLS;

        for (Map.Entry<Object, Object> x : sdkProperties.entrySet()) {
            final String key = x.getKey() + "";
            final String val = x.getValue() + "";

            if (key.startsWith(INTEGRATIONTESTS_ORG)) {

                Matcher match = orgPat.matcher(key);

                if (match.matches() && match.groupCount() == 1) {
                    String orgName = match.group(1).trim();
                    sampleOrgs.put(orgName, new SampleOrg(orgName, val.trim()));

                }
            }
        }

        for (Map.Entry<String, SampleOrg> org : sampleOrgs.entrySet()) {
            final SampleOrg sampleOrg = org.getValue();
            final String orgName = org.getKey();

            String peerNames = sdkProperties.getProperty(INTEGRATIONTESTS_ORG + orgName + ".peer_locations");
            String[] ps = peerNames.split("[ \t]*,[ \t]*");
            for (String peer : ps) {
                String[] nl = peer.split("[ \t]*@[ \t]*");
                sampleOrg.addPeerLocation(nl[0], grpcTLSify(nl[1]));
            }

            final String domainName = sdkProperties.getProperty(INTEGRATIONTESTS_ORG + orgName + ".domname");

            sampleOrg.setDomainName(domainName);

            String ordererNames = sdkProperties
                    .getProperty(INTEGRATIONTESTS_ORG + orgName + ".orderer_locations");
            ps = ordererNames.split("[ \t]*,[ \t]*");
            for (String peer : ps) {
                String[] nl = peer.split("[ \t]*@[ \t]*");
                sampleOrg.addOrdererLocation(nl[0], grpcTLSify(nl[1]));
            }

            String eventHubNames = sdkProperties
                    .getProperty(INTEGRATIONTESTS_ORG + orgName + ".eventhub_locations");
            ps = eventHubNames.split("[ \t]*,[ \t]*");
            for (String peer : ps) {
                String[] nl = peer.split("[ \t]*@[ \t]*");
                sampleOrg.addEventHubLocation(nl[0], grpcTLSify(nl[1]));
            }

            sampleOrg.setCALocation(httpTLSify(
                    sdkProperties.getProperty((INTEGRATIONTESTS_ORG + org.getKey() + ".ca_location"))));

            if (runningFabricCATLS) {
                String cert = "src/test/fixture/sdkintegration/e2e-2Orgs/channel/crypto-config/peerOrganizations/DNAME/ca/ca.DNAME-cert.pem"
                        .replaceAll("DNAME", domainName);
                File cf = new File(cert);
                if (!cf.exists() || !cf.isFile()) {
                    throw new RuntimeException("TEST is missing cert file " + cf.getAbsolutePath());
                }
                Properties properties = new Properties();
                properties.setProperty("pemFile", cf.getAbsolutePath());

                properties.setProperty("allowAllHostNames", "true");//testing environment only NOT FOR PRODUCTION!

                sampleOrg.setCAProperties(properties);
            }
        }

    }

}

From source file:com.swordlord.gozer.databinding.DataBindingMember.java

private void parseBindingMember() {
    // probably throw error in this case? -> no. DataBinding can be NULL!
    if (_strDataBindingMember == null) {
        return;//w  w  w .  jav a 2s.  c  o m
    }

    Pattern pattern = Pattern.compile(
            "^(@)?([a-z_0-9]*)(\\{[(\\?)?a-z_0-9,:='%\\s@\\[\\]\\(\\)]*\\})?(\\[[0-9]*\\])?$",
            Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);

    String[] bmElements = _strDataBindingMember.split("\\.");
    if (bmElements.length == 0) {
        LOG.error("Split of binding member return 0 elements: " + _strDataBindingMember);
        return;
    }

    // reset this, is no problem since works with lazy initialisation
    _strBindingPathName = null;
    int iElement = 0;

    for (String strBindingMemberElement : bmElements) {
        Matcher matcher = pattern.matcher(strBindingMemberElement);

        if (!matcher.find()) {
            LOG.error("DataBinding parser can't parse binding member: " + strBindingMemberElement);
            return;
        }

        if (matcher.groupCount() != 4) {
            LOG.error("Wrong group count during parsing of binding member element: " + strBindingMemberElement
                    + " in binding member: " + _strDataBindingMember);
            return;
        }

        DataBindingElement element = new DataBindingElement();

        element.setPathElement(matcher.group(2));

        String strFilter = matcher.group(3);
        if ((strFilter != null) && (strFilter.length() > 2)) {
            try {
                element.setFilter(strFilter.substring(1, strFilter.length() - 1));
            } catch (IndexOutOfBoundsException e) {
                LOG.error("strFilter is defect: " + strFilter);
                LOG.debug(e.getMessage());
                return;
            }
        }

        String strRowNumber = matcher.group(4);
        if ((strRowNumber != null) && (strRowNumber.length() > 2)) {
            try {
                element.setRowNumber(Integer.parseInt(strRowNumber.substring(1, strRowNumber.length() - 1)));
            } catch (NumberFormatException e) {
                LOG.error("RowNumber is not of type integer: " + strRowNumber);
                LOG.debug(e.getMessage());
                return;
            } catch (IndexOutOfBoundsException e) {
                LOG.error("RowNumber is defect: " + strRowNumber);
                LOG.debug(e.getMessage());
                return;
            }
        } else {
            if (iElement < bmElements.length - 1) {
                // wrong syntax, add 0 on our own
                element.setRowNumber(0);
                //element.isField(true);
            } else {
                element.setField(true);
            }
        }

        _dataBindingElements.add(element);

        iElement++;
    }
}

From source file:org.apache.nifi.processors.enrich.AbstractEnrichProcessor.java

/**
 * This method returns the parsed record string in the form of
 * a map of two strings, consisting of a iteration aware attribute
 * names and its values/*from  ww  w  .j  ava2 s . c om*/
 *
        
 * @param  rawResult the raw query results to be parsed
 * @param queryParser The parsing mechanism being used to parse the data into groups
 * @param queryRegex The regex to be used to split the query results into groups. The regex MUST implement at least on named capture group "KEY" to be used to populate the table rows
 * @param lookupKey The regular expression number or the column of a split to be used for matching
 * @return  Table with attribute names and values where each Table row uses the value of the KEY named capture group specified in @param queryRegex
 */
protected Table<String, String, String> parseBatchResponse(String rawResult, String queryParser,
        String queryRegex, int lookupKey, String schema) {
    // Note the hardcoded record0.
    //  Since iteration is done within the parser and Multimap is used, the record number here will always be 0.
    // Consequentially, 0 is hardcoded so that batched and non batched attributes follow the same naming
    // conventions
    final String recordPosition = ".record0";

    final Table<String, String, String> results = HashBasedTable.create();

    switch (queryParser) {
    case "Split":
        Scanner scanner = new Scanner(rawResult);
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            // Time to Split the results...
            String[] splitResult = line.split(queryRegex);

            for (int r = 0; r < splitResult.length; r++) {
                results.put(splitResult[lookupKey - 1],
                        "enrich." + schema + recordPosition + ".group" + String.valueOf(r), splitResult[r]);
            }
        }
        break;
    case "RegEx":
        // prepare the regex
        Pattern p;
        // Regex is multiline. Each line should include a KEY for lookup
        p = Pattern.compile(queryRegex, Pattern.MULTILINE);

        Matcher matcher = p.matcher(rawResult);
        while (matcher.find()) {
            try {
                // Note that RegEx matches capture group 0 is usually broad but starting with it anyway
                // for the sake of purity
                for (int r = 0; r <= matcher.groupCount(); r++) {
                    results.put(matcher.group(lookupKey),
                            "enrich." + schema + recordPosition + ".group" + String.valueOf(r),
                            matcher.group(r));
                }
            } catch (IndexOutOfBoundsException e) {
                getLogger().warn(
                        "Could not find capture group {} while processing result. You may want to review your "
                                + "Regular Expression to match against the content \"{}\"",
                        new Object[] { lookupKey, rawResult });
            }
        }
        break;
    }

    return results;
}

From source file:com.cisco.oss.foundation.tools.simulator.rest.container.SimulatorResponse.java

public ResponseBuilder generateResponse(SimulatorRequest simulatorRequest) {

    try {/*from w ww  .java2  s  . c  o  m*/
        Thread.sleep(latencyMs);
    } catch (InterruptedException e) {
        logger.error("Failed sleeping", e);
    }

    ResponseBuilder rb = Response.status(responseCode);

    if (!StringUtils.isEmpty(responseBody)) {
        String currentResponseBody = responseBody;

        //replace path param
        Matcher matcher = expectedUrlPattern.matcher(simulatorRequest.getPath());
        if (matcher.find()) {
            int matches = matcher.groupCount();
            //begin from 1 (0 is all the string)
            for (int i = 1; i < matches + 1; i++) {
                currentResponseBody = StringUtils.replace(currentResponseBody, "{$" + i + "}",
                        matcher.group(i));
            }
        }

        MultivaluedMap<String, String> queryParameters = simulatorRequest.getQueryParameters();

        //replace query params
        currentResponseBody = replaceAllQueryParamsInReponse(currentResponseBody, queryParameters);

        rb = rb.entity(currentResponseBody);
    }

    if (responseHeaders != null) {
        for (String headerKey : responseHeaders.keySet()) {
            rb.header(headerKey, responseHeaders.get(headerKey));
        }
    }

    return rb;
}

From source file:com.datatorrent.contrib.parser.RegexParser.java

@Override
public void processTuple(byte[] tuple) {
    if (tuple == null) {
        if (err.isConnected()) {
            err.emit(new KeyValPair<String, String>(null, "Blank/null tuple"));
        }/*from  w  ww . j  av a2 s .c  o m*/
        errorTupleCount++;
        return;
    }
    String incomingString = new String(tuple);
    if (StringUtils.isBlank(incomingString)) {
        if (err.isConnected()) {
            err.emit(new KeyValPair<String, String>(incomingString, "Blank tuple"));
        }
        errorTupleCount++;
        return;
    }
    try {
        if (out.isConnected() && clazz != null) {
            Matcher matcher = pattern.matcher(incomingString);
            boolean patternMatched = false;
            Constructor<?> ctor = clazz.getConstructor();
            Object object = ctor.newInstance();

            if (matcher.find()) {
                for (int i = 0; i <= matcher.groupCount() - 1; i++) {
                    if (delimitedParserSchema.getFields().get(i).getType() == DelimitedSchema.FieldType.DATE) {
                        DateTimeConverter dtConverter = new DateConverter();
                        dtConverter.setPattern((String) delimitedParserSchema.getFields().get(i)
                                .getConstraints().get(DelimitedSchema.DATE_FORMAT));
                        ConvertUtils.register(dtConverter, Date.class);
                    }
                    BeanUtils.setProperty(object, delimitedParserSchema.getFields().get(i).getName(),
                            matcher.group(i + 1));
                }
                patternMatched = true;
            }
            if (!patternMatched) {
                throw new ConversionException(
                        "The incoming tuple do not match with the Regex pattern defined.");
            }

            out.emit(object);
            emittedObjectCount++;
        }

    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException
            | ConversionException e) {
        if (err.isConnected()) {
            err.emit(new KeyValPair<String, String>(incomingString, e.getMessage()));
            logger.debug("Regex Expression : {} Incoming tuple : {}", splitRegexPattern, incomingString);
        }
        errorTupleCount++;
        logger.error("Tuple could not be parsed. Reason {}", e.getMessage());
    }
}